norbert Posted July 27, 2015 Share Posted July 27, 2015 Hi, System::Print(Filesystem::GetFileSize("steam_appid.txt")); return always 0; System::Print(FileSystem::GetFileType("steam_appid.txt")); but return 1 by GetFileType so the file is still there ? have the problem with each file. it's a bug? or my mistake? working under Windows. 7 and c++. Does anyone have the same problem? thanks norbert Quote Link to comment Share on other sites More sharing options...
reepblue Posted July 27, 2015 Share Posted July 27, 2015 What are you trying to do? Read steam_appid.txt, or get the game's root directory? Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
beo6 Posted July 27, 2015 Share Posted July 27, 2015 seems to crash for me in Lua. haven't tried it in C++ yet. //Edit: tested a bit more. using local path = "testfile.txt" System:Print(FileSystem:GetFileSize(path)) crashes. using local path = "testfile.txt" System:Print("size: "..FileSystem:GetFileSize(path)) prints "size: 0" not sure why it crashes the other time. Quote Link to comment Share on other sites More sharing options...
NightQuest Posted July 28, 2015 Share Posted July 28, 2015 it looks like a bug, honestly. This works, though - just use it the same way: class FS : public FileSystem { FS() : FileSystem() {} public: static int GetFileSize(const std::string& path) { std::string file = RealPath(path); struct stat filestat; stat(&path[0], &filestat); return static_cast<int>(filestat.st_size); } }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.