I’m having a small issue with writing a file to the data folder.
The above code writes a file to the directory garrysmod/data. Thus being garrysmod/data/testing.txt
This above code reads the file and all of its content of garrysmod/data/testing.txt, Nothing wrong is there.
Now, what if we want to write a file to the garrysmod/gamemodes/myGamemode/content/data folder?
Answer: You can’t, not without a DLL anyway
However, you can read from the gamemodes/content/data directory just fine. Lets say you made a text file in garrysmod/gamemodes/myGamemode/content/data, called it “anothertest.txt” and inside the file put “bee”.
[lua]print( file.Read(“anothertest.txt”) )[/lua]
Your output in the console would be, “bee”.
So I ask, Why arn’t we allowed to write files to our gamemodes data folder, yet we can read it? I wanted to write to my gamemode folder to keep everything together, keep the data folder from becoming a mess. Which yeah people will say organize your files into different directories. But what if I want to release my gamemode? I’ll have to pack it into a rar and remove all the other text files which are not needed in the release or in any way related to the gamemode. Why can’t we just have the option/function to write to our gamemodes data folder?