Use folder env vars for all platforms ?

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

Post Reply
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 835
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Use folder env vars for all platforms ?

Post by Lone_Wolf »

from master Documentation/docs/index.md

Code: Select all

## Linux

The AppImage can be configured to use alternative locations by setting various environment variables:

| Environment Variable | Value  | Game Folder                                      |
|:---------------------|:-------|:-------------------------------------------------|
| `OO_DIRTYPE`         | xdg    | `$HOME/.local/share/Oolite`                      |
| `OO_DIRTYPE`         | legacy | `$HOME` (old folder structure - not recommended) |

More intricate setups are possible by specifying individual environment variables for different folders:

| Environment Variable      | Description                             | Default Path (if unset)                  |
|:--------------------------|:----------------------------------------|:-----------------------------------------|
| `OO_SAVEDIR`              | Directory for saved games               | `$GAME_DATA/SavedGames`                  |
| `OO_SNAPSHOTSDIR`         | Directory for screenshots/snapshots     | `$GAME_DATA/Snapshots`                   |
| `OO_LOGSDIR`              | Directory for game log files            | `$GAME_DATA/.logs`                       |
| `OO_MANAGEDADDONSDIR`     | Directory for OXPs managed by the game  | `$GAME_DATA/.ManagedAddOns`              |
| `OO_USERADDONSDIR`        | User-specified directory for OXPs       | `$GAME_DATA/AddOns`                      |
| `OO_ADDONSEXTRACTDIR`     | Directory for extracted OXPs            | `${OO_USERADDONSDIR:-$GAME_DATA/AddOns}` |
| `OO_ADDITIONALADDONSDIRS` | List of extra addon search paths        |                                          |
| `OO_GNUSTEPDIR`           | GNUstep directory                       | `$GAME_DATA/.GNUstep`                    |
| `OO_GNUSTEPDEFAULTSDIR`   | User preferences defaults file location | `$GAME_DATA`                             |
I feel that this could be very useful for many more platforms then just linux appimages .

Windows, *BSDs, macOS and Google Android all support environment vars.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 746
Joined: Sat Aug 09, 2014 4:16 pm

Re: Use folder env vars for all platforms ?

Post by Commander_X »

Lone_Wolf wrote: Tue Mar 31, 2026 2:36 pm
[...]
Windows, *BSDs, macOS and Google Android all support environment vars.
They do, but I think for Windows the choice is to hardcode them into the .exe file.

BTW of env vars, I was very pleasantly surprised when using the run_oolite.sh script in the build directory, to find out that finally one of the missing features I envied Windows version for, was available: per-instance conf/saves/addons, and the rest, as opposed to per-user.

Alas, it gets wiped out during a "make clean", but I can live with that.
Post Reply