Steam game on MacOS: folder permission issue

0 favourites
  • 8 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • Our NWjs game writes save files to Documents folder. When you install it with Steam and run for the first time on Mac, it displays a dialogue like this:

    After that the game works fine, can read/write files from Documents folder.

    However, if we release a new version and Steam updates the game, it looks like this permission gets removed. The game doesn't prompt again for access, but it can't read any files from the Documents folder and throws this error in console log:

    Error: EPERM: operation not permitted, open '/Users/username/documents/GameName/Filename"

    There are two ways to fix it - either uninstall/reinstall the game and confirm the permission again, or give full disk access to the game. Neither of which is a good solution.

    Has anyone had this issue?

    If this is a bug, who should we report it to - Scirra, Google (NWjs), or Steam?

    Tagged:

  • I would guess that's a security restriction of macOS that comes back automatically if the app is ever changed. I'd recommend saving data somewhere where permission is not required, such as the app data folder on Windows (not sure what the equivalent is on macOS though). The Documents folder is actually a very security sensitive folder as in theory an application could read all your personal information and upload it to the web, hence the prompt.

  • Thanks!

    As I understand, the MacOS equivalent of appdata folder is

    ~/Library/Application Support/<appname>

    One problem is that in NWJS we can't use "~" character in file path, I am not sure how to properly access ~/Library without it.

    Also, changing the save file location for existing players may be an issue, hopefully it's possible with Steam Cloud.

  • Ashley

    I'd recommend saving data somewhere where permission is not required, such as the app data folder on Windows (not sure what the equivalent is on macOS though

    So I tried NWjs.ProjectFilesFolder and NWjs.AppFolder expressions. Both return some crazy unusable locations which we won't be able to configure in Steam Cloud.

    The MacOS equivalent of Windows appdata folder is:

    /Library/Application Support

    Unfortunately, NWjs app still can't create sub-folders at that location. It doesn't prompt for a permission, but I can see "permission denied" error in console.

    Is there any working solution?

  • I don't know how to do it with nwjs plugin but

    You can write file to the "/Library/Application Support/" folder using js code.

    I created an example "app.nw" below, you can check it out.

    oyunkulturu.com/temp/app.nw.zip

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Eren Thanks! Can this code create a subfolder in /Library/Application Support/ ? This is the part that doesn't work for me. I'm afraid it won't be any different with JS.

    After I create the subfolder manually (Mac asks me to enter my password), the game can write files to that subfolder.

  • Can this code create a subfolder

    You can create subfolders and write files with the new link I just posted.

    https://oyunkulturu.com/temp/new_appnw.zip

    (Mac asks me to enter my password)

    My Mac doesn't give any warnings or ask password, but it might be because my version is old.(high sierra)

  • Was this ever solved?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)