• Creating a subfolder for a settings file (file. library)?
    3 replies, posted
I simply want to make subfolder in the data folder, because when i have addons that save stuff in a txt file i want them all to be in one folder thats for all my addons. So im not spamming Peoples data folder with txt files. But i cannot manage to create a subfolder and then put txt files in there. First i tryd file.Write("subfolder/settings.txt") but that didnt worked. I then realized through the gmod wiki that theres file.CreateDir which i used as file.CreateDir("trackster_addons") which didnt created any folder either..now i made this, hoping/thinking this would work, but all it does is creating the txt file in the data folder, without the subfolder. function KatoDestiny0()     local exist = file.Exists("trackster_laboratory/Kato_Settings.txt","DATA")     if exist then         file.Write("trackster_laboratory/Kato_Settings.txt","0")     else         file.CreateDir("trackster_laboratory")         file.Write("trackster_laboratory/Kato_Settings.txt","0")     end end function KatoDestiny1()     local exist = file.Exists("trackster_laboratory/Kato_Settings.txt","DATA")     if exist then         file.Write("trackster_laboratory/Kato_Settings.txt","1")     else         file.CreateDir("trackster_laboratory")         file.Write("trackster_laboratory/Kato_Settings.txt","1")     end end concommand.Add("Kato_Destiny_0", KatoDestiny0) concommand.Add("Kato_Destiny_1", KatoDestiny1) do i need some other file. or am i doing something else wrong? I read through the description of file.Write and file.CreateDir but i dont understand why its creating the file in data, without any subfolder..
Works just fine for me avoid code duplication if not exist then file.CreateDir("trackster_laboratory") end file.Write("trackster_laboratory/Kato_Settings.txt","1")
wut? then why did it not work for me?
I'd tell you if I knew, the point was to let you know that it might be something on your end.
Sorry, you need to Log In to post a reply to this thread.