• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM A question about editing included files (from within a GMS executable)

The short version: can I edit the files that I have included with a project?

I am taking the text output of the "show information" summary from an object, and placing it in a standard text file (as it outputs in html for some reason) so it can be read and parsed for local / permanent variables. It's then placed in the included files.

However, this info as is has some things that aren't necessary (such as commented out lines of behind the scenes engine activity), and instead of manually removing it I'm trying to rewrite the included file with only what is required. The contents are read, the excess is removed, and the rest is stored in a ds list. I then want to delete the original and redo it from the ds list contents, or overwrite the original.

Is that possible with the sandboxing? I thought it would be within the system limits to do this with included files, but am struggling to make it work.

1) Would giving system permission allow me to delete an included file after using it? (get_open_filename etc)

2) If that works, and allows me to delete the original file, then presumably the system permission would end there?

3) If 1 and 2 are possible, would a second system permission request allow me to save the new file (rewritten) back into the included files location?
 

JaimitoEs

Member
Take a look to this link: https://docs.yoyogames.com/source/dadiospice/002_reference/file handling/file system limits.html

You can modify the content of your working directory. If you have a file in the "included files" folder and this file are not present in the working directory of your proyect "app data folder/your proyect", gamemakers studio reads the file from the included file. If you rewrite this file, the new file are saved into your working directory. That means you still getting the old version from the included files, but once the file exists in the working directory, all the managment is maded in this folder. Normally, in the final version of your game, you need to copy your working directory and traslate it to the included file folder (if you want a modified start values of your data, for example, creating a level data, the level is saved in the working directory, if you don´t place this level into the included file in the final version of your game, for android like an example, the program can not read the level once is readed 1 time in the included file folder ).
 
Take a look to this link: https://docs.yoyogames.com/source/dadiospice/002_reference/file handling/file system limits.html

You can modify the content of your working directory. If you have a file in the "included files" folder and this file are not present in the working directory of your proyect "app data folder/your proyect", gamemakers studio reads the file from the included file. If you rewrite this file, the new file are saved into your working directory. That means you still getting the old version from the included files, but once the file exists in the working directory, all the managment is maded in this folder. Normally, in the final version of your game, you need to copy your working directory and traslate it to the included file folder (if you want a modified start values of your data, for example, creating a level data, the level is saved in the working directory, if you don´t place this level into the included file in the final version of your game, for android like an example, the program can not read the level once is readed 1 time in the included file folder ).
Thanks for the reply. I know about the appdata folder, and can manually reinsert the edited file back into the included files.

But as there is the means to give system permission to the user (myself, within my own "editing program") that seems a bit long winded. I know it says "you can NEVER write to the file bundle folder", but then what is the point of allowing access out of the sandbox if it still won't let you access that area?

Ultimately I want to use this for myself, but would also like to do it as a tutorial here on the community. The latter is maybe a bit pointless if the user ends up having to do a lot of the editing in an external piece of software. You have to paste the text info from the object into notepad anyway (because it exports it in html format), so might as well remove the engine specific lines yourself - seeing as how you're already in an editor. Further editing isn't necessary, but it also means the user has to be a bit more active outside of the GMS environment (using notepad beforehand) and I want to avoid that.
 

JaimitoEs

Member
Thanks for the reply. I know about the appdata folder, and can manually reinsert the edited file back into the included files.

But as there is the means to give system permission to the user (myself, within my own "editing program") that seems a bit long winded. I know it says "you can NEVER write to the file bundle folder", but then what is the point of allowing access out of the sandbox if it still won't let you access that area?

Ultimately I want to use this for myself, but would also like to do it as a tutorial here on the community. The latter is maybe a bit pointless if the user ends up having to do a lot of the editing in an external piece of software. You have to paste the text info from the object into notepad anyway (because it exports it in html format), so might as well remove the engine specific lines yourself - seeing as how you're already in an editor. Further editing isn't necessary, but it also means the user has to be a bit more active outside of the GMS environment (using notepad beforehand) and I want to avoid that.
I'm not sure I understand your question, but the area is always accesible, other thing is... there are nothing when you pack your program, because is this, a working directory of your program, this working directory is created when the application are installed into a device, so, if your program need to start reading a launcher file, this file need to exist in the included file folder, respecting the hierarchy. Included files is a dinamic link of your working directory, so you only need to recreate this hierachy in the included file (Your project/ your folders/your initial files). After this, all content are maded in your program is saved into your working directory. If your question is about exporting a file to a windows folder, like "documents" is another story...
 
Last edited:
@JaimitoEs
Sorry - I'm not great at explaining what I'm trying to do, or programming :) , and I realise there is a bit of a language barrier too. I appreciate you taking the time to try and help, but maybe a different approach is needed due to the sandboxing limits.
 
Top