MU
Add portable support
Mudlet/Mudlet#7375

/claim #888

Brief overview of PR changes/additions

This PR:

  • refactors Mudlet initialisation code to use a single source of truth for config directory paths
  • change QSettings storage to an IniFormat file in the config directory and adds migration code from old formats
  • adds support for a <executable_dir>/portable.txt marker which sets the config directory to <executable_dir>/portable

Motivation for adding to Mudlet

This PR teaches Mudlet to store data portably.

Usage Instructions

If you’re interested in trying out this PR, you can download the CI builds from the add-deployment-links bot below.

There are currently two ways to enable portable mode for Mudlet (in order of importance):

  • You can create an empty portable.txt file in the same folder as the Mudlet executable (or appimage etc.)
    • This will tell Mudlet to use a folder named portable (in the same folder as the executable) for its data
  • You can create an ~/.config/mudlet/portable.txt file with its contents being a path on your filesystem
    • This will tell Mudlet to use the path written in the file as the folder for its data
      • e.g. the contents could be /mount/media/flashdrive/mudlet_data or D:\games\portable\mudlet_data
    • The path can be relative, in which case it will be interpreted relative to the Mudlet executable’s folder
    • Mudlet will create exactly one folder, that is, the last part of the given path, if it doesn’t exist already. At least everything up to its parent folder must exist already or it will lead to an error.
      • e.g. if given D:\games\portable\mudlet_data, at least D:\games\portable must be an existing folder
      • This is to avoid taking unintended input. If you see this error but this actually is what you want, just create those folders manually

Any errors will result in the issue being printed to stderr and the program terminating. You probably won’t see the error outputs if launched from GUI so it’s recommended to start Mudlet from the terminal.

Ofc when you first launch Mudlet in portable mode, it will start with a new clean config in the respective folder, just like a new install. If you wish to migrate your existing config data to be portable:

  • You need to launch this build at least once (without any portable.txt)
    • This is because it needs to migrate config files from the old format to the new, portable-friendly one
  • Then you can just copy/move your default data directory ~/.config/mudlet to wherever you want and use one of the above portable.txts to point Mudlet to that path.

Claim

Total prize pool $200
Total paid $220
Status Approved
Submitted July 30, 2024
Last updated August 10, 2024

Contributors

CO

ConcurrentCrab

@ConcurrentCrab

100%

Sponsors

MU

Mudlet

@Mudlet

$200 paid
+$20 tip!