working_directory, program_directory, and temp_directory GMStudio compliance [u524]

Reporter: time-killer-games  |  Status: open  |  Last Modified: January 07, 2018, 07:44:10 PM

For the default compliance mode, (GMStudio compatibility), working_directory, program_directory, and temp_directory need to include the final slash at the end of the string they return. Nocturne on the GMC said that program_directory and temp_directory do not include that slash due to a bug in GMStudio, and that it should include the final slash like working directory does.

Long story short:

In GM 8.1 and below compliance mode - there should be no slash at the end for these 3 constants.
In GMStudio 1.x and above compliance mode - there should be a slash at the end for these 3 constants.

temp_directory also seems to not be fully implemented, because whenever I use it, even though LGM gives it syntax highlighting as if it were implemented, it throws and error saying the value of the constant is undefined.

There's also a new directory constant in GMStudio called "game_save_id" - this still needs to be implemented into ENIGMA - it's GMStudio's sandbox directory. game_save_id includes the final slash and in GM 8.1 and below compliance this constant shouldn't be declared. Only declare/implement it in GMStudio 1.x and above compliance.

ENIGMA was originally based on GM 8.1 and below - so it makes sense why the last slash isn't there, because that's how GameMaker originally worked.

This is actually not that big of a deal, just go ahead and add / anyway. Ideally you should be using / because those will work on Linux and Mac as well as Windows.

For example, I ran this just fine in command prompt:

C:\>cd C:///Users///Owner////Desktop


C:\>cd C:\\\Users////Owner\\/Desktop


Just go ahead and add one anyway because even if it is there it won't break.


theres no need to emulate gm's incosistent behavior for this as robert said you can just add a / yourself if needed without harm.

The point of compliance isn't that users can make it work—we don't need a whole lot of GM support at all for that to be true. It's that it just does work. And as Robert said, having a slash at the end of these paths makes it work. So as long as we're doing that, there's no reason to code in Game Maker's typos.

Still an issue because it does not do what Josh says:

  • ENIGMA: C:\Users\Owner\AppData\Local\Temp
  • GM5: C:\Users\Owner\AppData\Local\Temp\gm_ttt_70105
  • GM8: C:\Users\Owner\AppData\Local\Temp\gm_ttt_85358
  • GMS: C:\Users\Owner\AppData\Local\Temp\gm_ttt_3529\gm_ttt_52603\
  • ENIGMA: undefined reference to `enigma_user::temp_directory'
  • GM5: C:\Users\Owner\AppData\Local\Temp\gm_ttt_5543
  • GM8: C:\Users\Owner\AppData\Local\Temp\gm_ttt_41994
  • GMS: C:\Users\Owner\AppData\Local\Temp
  • ENIGMA: C:\Users\Owner\AppData\Local\Temp
  • GM5: Unknown variable
  • GM8: C:\Users\Owner\AppData\Local\Temp\gm_ttt_28607
  • GMS: C:\Users\Owner\AppData\Roaming\GameMaker-Studio

If it was doing what Josh said, then TKG would have probably never even reported this. I should say that most APIs/frameworks like Qt, Java, etc. always give a directory without the final slash. So really GM: Studio is just being nutty and inconsistent with previous GameMaker versions.

However, since this does seem like it may help novices make less mistakes and not forget the final slash, perhaps we could adopt it. I'd say to only do this if the directory functions would continue working with the final slash.

Notice: Undefined variable: context in /var/www/html/ on line 114
Please sign in to post comments, or you can view this issue on GitHub.