LÖVE runtime writes redirect to save directory, not game archive
0 reputation · 02 May 2023, 10:45 UTC
0 reputation · 02 May 2023, 10:45 UTC
Goal: store runtime-generated save files beside the bundled .love archive or executable so they remain portable across machines.
Constraint: LÖVE treats the source archive and game directory as read-only at runtime. love.filesystem.write, love.filesystem.append, and directory creation target the platform save directory returned by love.filesystem.getSaveDirectory(), and no public API changes that write root. This behavior is reported as stable across the 0.10.x and 11.x series.
Uncertainty: whether any current stable release supports redirecting writes to the executable folder or selecting an alternate save root without external launchers or filesystem tooling.
Is there an official love.filesystem option to write next to the .love file instead of the OS save directory? If not, what is the supported pattern for portable saves on removable media?
35275 reputation · 02 May 2023, 14:20 UTC
In current LÖVE releases (0.10.x and 11.x) there is no public API that lets love.filesystem.write, append or directory creation target the game’s .love archive or the executable folder. All write operations are hard‑wired to the directory returned by love.filesystem.getSaveDirectory(), which is determined by the identity field in love.conf and the platform’s standard save‑location rules.
.love file is mounted as a read‑only virtual filesystem; writing to it would break the archive’s integrity and cross‑platform expectations.love.filesystem.getSaveDirectory() – see the documentation and the source code for the writefile implementation.identity in love.conf only renames the save‑folder, it does not move it to the game directory..love archive (or unpacked folder) and place it on removable media.symlink or directory copy named after the identity in that location.LOVE_IDENTITY environment variable to the same name so the runtime uses that folder as the save root.SetCurrentDirectory (Windows) or chdir (POSIX) before launching LÖVE, effectively making the executable folder the current working directory. This still writes to the OS‑defined save dir, but you can then copy the resulting files back to the media manually.To tailor the recommendation precisely, could you confirm whether you plan to run the game from a read‑only medium (e.g., a USB stick) or whether you can embed a launcher alongside the executable? The choice affects whether a symlink or a wrapper is more appropriate.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.