file.Size not working or am I blind to something?

I am simply trying to get the size of the file that I wrote, and it seems the file.Size function is not working?



file.Write( "derp/herp.txt", "Test File" )
local filesize = file.Size( "data/derp/herp.txt", true )
PrintMessage( HUD_PRINTTALK, filesize )

This just prints “-1”, please tell me I’m just missing something :frowning:

file.Size only works in the data folder when the second argument is false/nil.

But I set the boolean to true :confused:

I’ve tried directories other than data too and they don’t work

Try:
[lua]file.Write( “derp/herp.txt”, “Test File” )
local filesize = file.Size( “derp/herp.txt” )
PrintMessage( HUD_PRINTTALK, filesize )[/lua]

I get the output of 9.

Yeah that works for me but you’re using the data folder as the root. If you add a “true” argument file.Size( path, true ), then it should start from garrysmod/garrysmod/

Problem is it won’t get the file size from any files I put there

file.Size doesn’t seem to like using and folder inside of the base folder. Maybe it’s a bug, or maybe someone more experienced can explain more about it?

Well, at least we tried ^^