(Solved 100% this time) Saving to UserdataPath() saves the files in its parent folder

I’m pretty sure this was not the case recently, I don’t when this may have popped up, but here is the issue: when I save files to the UserdataPath(), instead of saving at the expected path: C:\Users\[USER]\AppData\Roaming\GDevelop 5, it places the file at C:\Users\[USER]\AppData\Roaming. This has never been the case previously. I am on Windows 10 so directories and issues may differ from PC to PC.

To reproduce (on a Windows PC):

  1. On a desktop version of GD5, save a file (like a screenshot) to Filesystem:UserdataPath()
  2. Check C:\Users\[USER]\AppData\Roaming\GDevelop 5, and you will find no file there.
  3. Check C:\Users\[USER]\AppData\Roaming (the first path’s parent folder) and you will find the saved file there

This is accurate. If you ever had it going to the GDevelop 5 folder before on a published games, that was an error.

The only place that would ever save to the %appdata%\GDevelop 5 folder on a published game was if you’re running a preview. This is because in a preview, the GDevelop 5 folder is the executable and temporary user path for the game. On an exported game it’d back to windows.

Filesystem:UserdataPath() is the same as going to Start > Run in windows and opening %appdata% in the run box (once you export/publish/build the game)

File system [GDevelop wiki] has more details on each of the expressions at the bottom.

1 Like

Ah, thanks for the clarification! Always had it go to \GDevelop5 in the past assuming it was intended behavior. Thanks SS!

No worries, it is entirely possible that the behavior was broken in previews before, maybe? Now you’re going to make me check. :smiley:

1 Like

Okay, I’m remembering right, but the wrong expression. (editing above post for correct details)

If you’re in a preview:
UserAppData = %appdata%\GDevelop 5
ExecutableFolderPath() = %localappdata%\Progams\GDevelop (or wherever you installed Gdevelop to)

If you’re on an exported game:
UserAppData = %appdata%
ExecutableFolderPath() = Whereveryourgameinstalls too.

The above were all tested on 5.0.110 and 5.0.140.

1 Like

Ergo, would that not mean that this issue is in fact a bug? My tests were done in a preview using UserdataPath(). this is great :upside_down_face:

If you’re asking “Should that expression show \Gdevelop 5 in a preview”, the answer I’ve been given is yes, that is how that function works. (not a bug, something from Electron itself)

If you’re saying “I’m not getting the GDevelop 5 folder in a preview”, then it may be a bug, but that’s going to be something very specific to your project as I just tested it on the newest release and it’s behaving as expected.

Ok I figured out what the issue was. I was creating screenshots, and their names had “/” s in them for the date, which it didn’t like.