[Scummvm-tracker] [ScummVM :: Bugs] #17351: COMMON: Windows portable EXE creates a `Saved games` folder in EXE directory even if a different `savepath=` is specified.

ScummVM :: Bugs trac at scummvm.org
Tue Oct 13 01:37:15 UTC 2026


#17351: COMMON: Windows portable EXE creates a `Saved games` folder in EXE
directory even if a different `savepath=` is specified.
-------------------------------------------------+-------------------------
Reporter:  nimaid                                |       Owner:  (none)
    Type:  defect                                |      Status:  new
Priority:  low                                   |   Component:  Common
 Version:                                        |  Resolution:
Keywords:  saves, windows, portable, Saved       |        Game:
  games, ini, savepath                           |
-------------------------------------------------+-------------------------
Description changed by nimaid:

Old description:

> **Version:** ScummVM 2026.3.0, Windows x64 zipfile, portable mode
>
> = Covefe
>
> This is **not** written by AI. This was not written with the help of AI.
> This was not reasearched by AI. This bug report was compiled by me, Ella
> Jameson nimaid), by hand, and with great care. I'm autistic and can't
> realy write these sort of reports any differetn than I have all my life:
> With headers and sections and verbose explainations. I have put so much
> effort into the formatting so you all can understand it. Please reade it
> with att least as much care as I put into making it.
>
> = Summary
>
> When running the Windows zipfile version of ScummVM in portable mode
> (`scummvm.ini` included in the same directory as `scummvm.exe`), no
> matter where the saved games folder is set using the  `--savepath=`
> argument or via the `savepath=` field in `scummvm.ini`, a folder named
> `Saved games` is created in the same directory as `scummvm.exe`. Games do
> actually save to the `savepath=` location, but even if that is set
> somewhere other than the directory where `scummvm.exe` resides, if the
> scummvm directory is read-only, it will fail to launch with the following
> error: `Cannot create ScummVM Saved games folder`. This makes the program
> unusable if located in a read-only location, like a CD-ROM.
>
> = Recreating
>
> You need a read-only filesystem to recreate this. The easiest way I know
> to do that on Windows is to make an ISO, but any read only directory
> without new file creation permissions will work. The filesystem needs the
> following directory structure:
> {{{
> MyCD.iso\
>   - scummvm\
>     - scummvm.exe
>     - scummvm.ini
>   - Run.bat
> }}}
> The `scummvm.ini` file can be blank.
>
> The contents of `Run.bat` should be as follows:
> {{{
> @echo off
>
> set "SCRIPT_DIR=%~dp0"
> if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
>
> set "SCUMMVM=%SCRIPT_DIR%\scummvm\scummvm.exe"
>
> set "SAVE_DIR=%APPDATA%\ScummVM\Saved Games"
> set "SCREENSHOT_DIR=%USERPROFILE%\Pictures\ScummVM Screenshots"
> set "LOG_DIR=%APPDATA%\ScummVM\Logs"
>
> if not exist "%SAVE_DIR%" mkdir "%SAVE_DIR%"
> if not exist "%SCREENSHOT_DIR%" mkdir "%SCREENSHOT_DIR%"
> if not exist "%LOG_DIR%" mkdir "%LOG_DIR%"
>

> start "" /b "%SCUMMVM%" --savepath="%SAVE_DIR%"
> --screenshotpath="%SCREENSHOT_DIR%" --logfile="%LOG_DIR%\logfile.log"
> }}}
>
> As you can see, the `savepath` along with the other paths are set in the
> `%APPDATA%` and `%USERPROFILE%` folders on the `C:\` drive, so one might
> expect that portable ScummVM would have no reason left to try and write
> to the program directory, which of course, on a CD is read-only and would
> fail.
>
> Mount `MyCD.iso` as a virtual disk (modern Windows supports this
> natively), and run `Run.bat`. You should get the error: `Cannot create
> ScummVM Saved games folder`
>
> Now extract that ISO to a folder named MyCD. Try running `Run.bat` again,
> and note how while the program starts up without issue, it creates an
> unused `Saved games` folder next to `scummvm.exe`. This confirms the
> error was due to ScummVM trying to write to the read-only CD.
>
> = Expected Behavior
>
> The expected behavior is for the Windows zipfile in portable mode to
> create a new saved games folder wherever is specified in either the
> `scummvm.ini` file or via the `--savepath=` argument, if they are
> explicitly set by the user, regardless of portable mode. This way, it
> would be possible to run `scummvm.exe` from read-only media like a CD
> while saving the data somewhere on the local hard drive. Currently trying
> to do this *would* work if it weren't for the hard-coded folder failing
> to be created in the same folder as `scummvm.exe` regardless of the
> actual setting for the `--savepath=` argument or the `savepath=` field in
> `scummvm.ini`. The workaround is to store the `.ini` in a seperate
> direcctory than the `.exe`, but this feels kludgy.
>
> It seems like an oversight to me that the program will ignore explicit
> command line flags and `.ini`. A pretty easy oversight to make, and it
> won't impact most users, but it's probably something worth fixing. I'll
> happily do it myself if people hekp me understand how to do what I want.
> I already gave myself a few migraines working through the source figuring
> it out myself, all I figured out so far is the location of the issue.
>
> = Location in Source Code
>
> I have tracked down the issue to a specific line of code that should be
> only conditionally run in `backends/saves/windows/windows-saves.cpp`:
> https://github.com/scummvm/scummvm/blob/ff4e32d90c625b512ed0346bc5d3c7f6ef6e9ac3/backends/saves/windows
> /windows-saves.cpp#L41:
> {{{
> ...
>     if (isPortable) {
>         Win32::getProcessDirectory(defaultSavepath, MAX_PATH);  // <--
> BUG HERE
>         // Should override this behavior if `savepath` is specified via
> argument or `scummvm.ini`
>         // i dont confidently know how to get those path variables and
> test for the presence of CMD / INI options or I would make a PR just
> putting this in an `if` statement, if someone can explain ill do the PR
>     } else {
>         // Use the Application Data directory of the user profile
>         if (!Win32::getApplicationDataDirectory(defaultSavepath)) {
>             return;
>         }
>     }
>
>     _tcscat(defaultSavepath, TEXT("\\Saved games"));
>     if (!CreateDirectory(defaultSavepath, nullptr)) {
>         if (GetLastError() != ERROR_ALREADY_EXISTS)
>             error("Cannot create ScummVM Saved games folder");
>     }
> ...
> }}}
>
> I'm not familiar enough with the structure of this project to make a PR
> to fix it. But I hope this bug report is at least detailed enough to
> enable someone else to fix it soon! Or you can explain how to do what I
> want and I can make th PR.
>
> Thank you all so much for all you contribute to this project! <3 I'm
> hoping to learn enough about the codebase through this to try and help
> address other tickets. i figure this is a good, simple bug that hasa
> fairly easy fix, so it's a good place to learn more about the structure
> of the codebase.

New description:

 **Version:** ScummVM 2026.3.0, Windows x64 zipfile, portable mode

 = Covefe

 This is **not** written by AI. This was not written with the help of AI.
 This was not reasearched by AI. This bug report was compiled by me, Ella
 Jameson (nimaid), by hand, and with great care. I'm autistic and can't
 realy write these sort of reports any differetn than I have all my life:
 With headers and sections and verbose explainations. I have put so much
 effort into the formatting so you all can understand it. Please reade it
 with att least as much care as I put into making it.

 = Summary

 When running the Windows zipfile version of ScummVM in portable mode
 (`scummvm.ini` included in the same directory as `scummvm.exe`), no matter
 where the saved games folder is set using the  `--savepath=` argument or
 via the `savepath=` field in `scummvm.ini`, a folder named `Saved games`
 is created in the same directory as `scummvm.exe`. Games do actually save
 to the `savepath=` location, but even if that is set somewhere other than
 the directory where `scummvm.exe` resides, if the scummvm directory is
 read-only, it will fail to launch with the following error: `Cannot create
 ScummVM Saved games folder`. This makes the program unusable if located in
 a read-only location, like a CD-ROM.

 = Recreating

 You need a read-only filesystem to recreate this. The easiest way I know
 to do that on Windows is to make an ISO, but any read only directory
 without new file creation permissions will work. The filesystem needs the
 following directory structure:
 {{{
 MyCD.iso\
   - scummvm\
     - scummvm.exe
     - scummvm.ini
   - Run.bat
 }}}
 The `scummvm.ini` file can be blank.

 The contents of `Run.bat` should be as follows:
 {{{
 @echo off

 set "SCRIPT_DIR=%~dp0"
 if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"

 set "SCUMMVM=%SCRIPT_DIR%\scummvm\scummvm.exe"

 set "SAVE_DIR=%APPDATA%\ScummVM\Saved Games"
 set "SCREENSHOT_DIR=%USERPROFILE%\Pictures\ScummVM Screenshots"
 set "LOG_DIR=%APPDATA%\ScummVM\Logs"

 if not exist "%SAVE_DIR%" mkdir "%SAVE_DIR%"
 if not exist "%SCREENSHOT_DIR%" mkdir "%SCREENSHOT_DIR%"
 if not exist "%LOG_DIR%" mkdir "%LOG_DIR%"


 start "" /b "%SCUMMVM%" --savepath="%SAVE_DIR%"
 --screenshotpath="%SCREENSHOT_DIR%" --logfile="%LOG_DIR%\logfile.log"
 }}}

 As you can see, the `savepath` along with the other paths are set in the
 `%APPDATA%` and `%USERPROFILE%` folders on the `C:\` drive, so one might
 expect that portable ScummVM would have no reason left to try and write to
 the program directory, which of course, on a CD is read-only and would
 fail.

 Mount `MyCD.iso` as a virtual disk (modern Windows supports this
 natively), and run `Run.bat`. You should get the error: `Cannot create
 ScummVM Saved games folder`

 Now extract that ISO to a folder named MyCD. Try running `Run.bat` again,
 and note how while the program starts up without issue, it creates an
 unused `Saved games` folder next to `scummvm.exe`. This confirms the error
 was due to ScummVM trying to write to the read-only CD.

 = Expected Behavior

 The expected behavior is for the Windows zipfile in portable mode to
 create a new saved games folder wherever is specified in either the
 `scummvm.ini` file or via the `--savepath=` argument, if they are
 explicitly set by the user, regardless of portable mode. This way, it
 would be possible to run `scummvm.exe` from read-only media like a CD
 while saving the data somewhere on the local hard drive. Currently trying
 to do this *would* work if it weren't for the hard-coded folder failing to
 be created in the same folder as `scummvm.exe` regardless of the actual
 setting for the `--savepath=` argument or the `savepath=` field in
 `scummvm.ini`. The workaround is to store the `.ini` in a seperate
 direcctory than the `.exe`, but this feels kludgy.

 It seems like an oversight to me that the program will ignore explicit
 command line flags and `.ini`. A pretty easy oversight to make, and it
 won't impact most users, but it's probably something worth fixing. I'll
 happily do it myself if people hekp me understand how to do what I want. I
 already gave myself a few migraines working through the source figuring it
 out myself, all I figured out so far is the location of the issue.

 = Location in Source Code

 I have tracked down the issue to a specific line of code that should be
 only conditionally run in `backends/saves/windows/windows-saves.cpp`:
 https://github.com/scummvm/scummvm/blob/ff4e32d90c625b512ed0346bc5d3c7f6ef6e9ac3/backends/saves/windows
 /windows-saves.cpp#L41:
 {{{
 ...
     if (isPortable) {
         Win32::getProcessDirectory(defaultSavepath, MAX_PATH);  // <-- BUG
 HERE
         // Should override this behavior if `savepath` is specified via
 argument or `scummvm.ini`
         // i dont confidently know how to get those path variables and
 test for the presence of CMD / INI options or I would make a PR just
 putting this in an `if` statement, if someone can explain ill do the PR
     } else {
         // Use the Application Data directory of the user profile
         if (!Win32::getApplicationDataDirectory(defaultSavepath)) {
             return;
         }
     }

     _tcscat(defaultSavepath, TEXT("\\Saved games"));
     if (!CreateDirectory(defaultSavepath, nullptr)) {
         if (GetLastError() != ERROR_ALREADY_EXISTS)
             error("Cannot create ScummVM Saved games folder");
     }
 ...
 }}}

 I'm not familiar enough with the structure of this project to make a PR to
 fix it. But I hope this bug report is at least detailed enough to enable
 someone else to fix it soon! Or you can explain how to do what I want and
 I can make th PR.

 Thank you all so much for all you contribute to this project! <3 I'm
 hoping to learn enough about the codebase through this to try and help
 address other tickets. i figure this is a good, simple bug that hasa
 fairly easy fix, so it's a good place to learn more about the structure of
 the codebase.

--
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/17351#comment:1>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list