diff --git a/src/modules/filesystem/Filesystem.h b/src/modules/filesystem/Filesystem.h index 444b18d41..e2c8c3d50 100644 --- a/src/modules/filesystem/Filesystem.h +++ b/src/modules/filesystem/Filesystem.h @@ -96,6 +96,7 @@ public: int64 size; int64 modtime; FileType type; + bool readonly; }; static love::Type type; diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index a5f8a042a..7833e051e 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -720,6 +720,7 @@ bool Filesystem::getInfo(const char *filepath, Info &info) const info.size = (int64) stat.filesize; info.modtime = (int64) stat.modtime; + info.readonly = stat.readonly != 0; if (stat.filetype == PHYSFS_FILETYPE_REGULAR) info.type = FILETYPE_FILE; diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 59bd2ada7..da03f2a0f 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -485,6 +485,9 @@ int w_getInfo(lua_State *L) lua_pushstring(L, typestr); lua_setfield(L, -2, "type"); + luax_pushboolean(L, info.readonly); + lua_setfield(L, -2, "readonly"); + // Lua numbers (doubles) can't fit the full range of 64 bit ints. info.size = std::min(info.size, 0x20000000000000LL); if (info.size >= 0)