Community Forum

temporary directory

Forum Overview >> Scripting

CategoryScripting
Created26.04.2017 11:34


Joachim Damm (jodamm) 26.04.2017 11:38
I need to save data in an XML file, with a saved game i save it in the savegame folder. But with a new started savegame there is no savegame folder. I saved it in the mods directory but it failed the certification because of this. Where should i save the data in this situation?

Bilbo Beutlin (BBeutlin) 26.04.2017 16:08
You could use the user directory of FS.
Define at beginning of your script:

myMod = {};
myMod.userDir = getUserProfileAppPath();

Then you can use it for example with
myFileName = myMod.userDir .. "/myFile.xml";

Of course it's better to use the savegame directory. But right - it is perhaps not available yet (on a freshly started game).
To have a fallback, you could use with the 'myMod.userDir' like above:
mySaveDir = Utils.getNoNil(g_currentMission.missionInfo.savegameDirectory, myMod.userDir)


Note: Log in to post. Create a new account here.