Where an installed app finds its assets and keeps its user data. More...
#include <Malena/Utilities/Paths.h>
Static Public Member Functions | |
| static const std::string & | executablePath () |
| static std::string | join (const std::string &a, const std::string &b) |
| static const std::string & | resourceDir () |
| static std::string | userDataDir (const std::string &appName) |
Where an installed app finds its assets and keeps its user data.
A development build runs from its build directory, so relative paths like "assets/logo.png" resolve against the current working directory and everything works. An installed app has neither property:
These two helpers give the app an install-safe answer on every platform. Use resourceDir() for read-only files that ship with the app (assets, bundled content) and userDataDir() for anything the app writes (config, save data, flags). Both return paths WITHOUT a trailing separator.
|
static |
Absolute path to the running executable ("" if undeterminable).
|
static |
Join two path segments with the platform separator.
|
static |
Absolute path to the directory holding the running executable, except on macOS inside a .app bundle, where it's the bundle's Contents/Resources — the conventional location for bundled assets.
Returns "." if the executable path can't be determined, which preserves the CWD-relative behaviour a dev build already relies on.
|
static |
Absolute path to a per-user, writable directory for this app, created on first call: macOS: ~/Library/Application Support/{appName} Windows: %APPDATA%%\{appName} Linux: $XDG_CONFIG_HOME/{appName}, else ~/.config/{appName}
Falls back to "." if neither the home directory nor the platform variable is available, and if the directory can't be created.
| appName | Folder name to use — the application's name. |