The directory where either the included files are stored or you have local storage.



Returns: String.


Working_directory can actually return two different values depending on what you are using it for. If you are writing a file to disk, working_directory points to the area of local storage that is reserved for your game on the target device (in windows this is "%LOCALAPPDATA%/gamedir/" where the "gamedir" is the directory with the name of your game). However, when reading from disk, working_directory can be either the local storage or the area where the included files are stored.

NOTE: the working_directory variable wiil return the path including the final backslash.

For example, if you have a default *.txt file included with your game and read it into memory using working_directory, then that file will be taken from the area where the included files are stored. If you then choose to write that information to a text file using working_directory, this will write the file to the target platforms local storage, where it will be read from the next time unless you instruct GameMaker: Studio to delete the file, in which case working_directory will once more point to the area where the included files are stored.

WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.


ini_open(working_directory + "temp_ini.ini");

This will open an ini file from the working directory of the game (creating it if it does not already exist). This could be the local storage, or the area where the included files are depending on whether the file being looked for exists in either place.

Back: File Handling
Next: program_directory
© Copyright YoYo Games Ltd. 2015 All Rights Reserved