GameMaker: Studio

GameMaker: Studio

View Stats:
maras Feb 11, 2018 @ 4:24am
File saving in specific folder?
I want to save an .ini file in the same path where is my game located but it always create files in AppData\Local\
Any idea?

Or can I somehow get the directory of the game?
working_directory and program_directory are not working
Last edited by maras; Feb 11, 2018 @ 4:26am
< >
Showing 1-8 of 8 comments
Zappy Feb 11, 2018 @ 4:38am 
Sadly, this is not possible without external extensions and such (like DLL files on Windows).
For Windows, I know of an extension for it, though; GMFileSystem[gmc.yoyogames.com]
...I have not really tried it out yet, but I plan on using it for a game I'm trying to make. I'm not quite sure whether the file paths you'd specify should start with working_directory, program_directory, or no path like that, but I'm sure you can test that and find that out yourself.
Last edited by Zappy; Feb 11, 2018 @ 4:38am
maras Feb 11, 2018 @ 4:43am 
Originally posted by Zappy:
Sadly, this is not possible without external extensions and such (like DLL files on Windows).
For Windows, I know of an extension for it, though; GMFileSystem[gmc.yoyogames.com]
...I have not really tried it out yet, but I plan on using it for a game I'm trying to make. I'm not quite sure whether the file paths you'd specify should start with working_directory, program_directory, or no path like that, but I'm sure you can test that and find that out yourself.
wow that GMFileSystem looks pretty complicated
Zappy Feb 11, 2018 @ 5:02am 
Originally posted by marasovec:
wow that GMFileSystem looks pretty complicated
It's set up to work so that instead of writing...
var file = file_text_open(working_directory + "\Data.sav") progress = file_text_read_real(file) file_text_close(file)
...you'd write...
var file = FS_file_text_open("Data.sav") progress = FS_file_text_read_real(file) FS_file_text_close(file)
(Again, I don't know whether you'd specify a path or not for the GMFileSystem functions, though.)


In other words, GMFileSystem is set up to mimic GameMaker: Studio's file-handling functions identically, just without the file location limits (as well as with some added extra functions).
Last edited by Zappy; Feb 11, 2018 @ 5:05am
The Winter Bud Feb 11, 2018 @ 2:52pm 
File System Limits[docs.yoyogames.com]

The above link will explain the limitations to the GameMaker and how it interacts with Windows and Window's security.

EDIT:
At the middle of the article you should read something to the nature of
Saving And Loading Outside The Sandbox
On the Windows platform there is one way to save and load files from outside of the sandbox and that is using the functions get_open_filename[docs.yoyogames.com] and get_save_filename[docs.yoyogames.com]. Both of these functions will require that the user select an area for loading and saving and the return string can then be used in the rest of the file functions to bypass the sandbox.
Last edited by The Winter Bud; Feb 11, 2018 @ 2:57pm
The Winter Bud Feb 11, 2018 @ 2:59pm 
Originally posted by "The Manual":
Platform Specific Saving/Loading
When working with GameMaker: Studio, you should know that each target platform has its own save area where files and directories can be written to and read from. Below is a list of those areas for each target:

Windows - Windows has all files in the %localappdata%\<Game Name> directory (on Windows 7 this is the /Users/<User Name>/AppData/Local/<Game Name> directory).

Mac OS - Storage will depend on whether the application is sandboxed or not (following Apples rules).

Ubuntu (Linux) - Files are stored in the Home/.config/gamename where "Home" is the users home directory - /home/<username>
HTML5 / Windows 8 (JS) - Everything is done through the local storage.

iOS - Storage is the standard location (as viewed through iTunes).

Android - Files are in the standard location (which is invisible unless the device is rooted) /data/data/<package name>.

Tizen - Files are in the standard location (which is invisible unless the device is rooted).

Windows Phone - Files are in the same location as the app.
Last edited by The Winter Bud; Feb 11, 2018 @ 3:00pm
maras Feb 11, 2018 @ 10:48pm 
Originally posted by The Winter Bud:
File System Limits[docs.yoyogames.com]

The above link will explain the limitations to the GameMaker and how it interacts with Windows and Window's security.

EDIT:
At the middle of the article you should read something to the nature of
Saving And Loading Outside The Sandbox
On the Windows platform there is one way to save and load files from outside of the sandbox and that is using the functions get_open_filename[docs.yoyogames.com] and get_save_filename[docs.yoyogames.com]. Both of these functions will require that the user select an area for loading and saving and the return string can then be used in the rest of the file functions to bypass the sandbox.
I'll try it. Thanks
Zappy Feb 12, 2018 @ 2:28am 
Originally posted by marasovec:
I'll try it. Thanks
If "it" is get_save_filename(filter, fname) or get_save_filename_ext(filter, fname, directory, caption), do keep in mind that those functions will show a standard file selection pop-up to the user, and that they have to select the file every time they boot up the game, which may get annoying if playing the game more than 2 or 3 times or so.

And also that after that, you'll have to use the normal file-reading/-writing/-saving functions anyway, so if you find them confusing, the above functions won't really help make it less confusing.
maras Feb 12, 2018 @ 3:49am 
I think I found a solution without get_*_filename()
Everytime I create the game using a single exe file its program_directory is somewhere in local BUT if I create the game as a zip file its program_directory is in the same folder as the exe
Last edited by maras; Feb 12, 2018 @ 3:51am
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Feb 11, 2018 @ 4:24am
Posts: 8