21 return {text.begin(), text.end()};
56std::expected<GamePaths, std::string>
158 bool copyOnly =
false);
173 bool copyOnly =
false);
192 return data /
"assets" /
"default";
T make_preferred(T... args)
Definition assetimport.h:11
std::optional< std::string > MakePortablePaths(const GamePaths &source, const std::filesystem::path &directory, bool copyOnly=false)
Export platform data as a portable installation, without copying the executable.
std::optional< std::string > ResetGamePaths(const GamePaths &paths, bool factoryReset=false)
Clear imported assets and asset caches, or all application data for a factory reset.
std::optional< std::filesystem::path > PackAssets(const std::filesystem::path &data, const std::filesystem::path &cache, std::string_view pack, const std::filesystem::path &fallback={}, std::string_view region={})
The directory the game reads its assets from with a pack selected.
std::optional< std::filesystem::path > FindAssetData(const std::filesystem::path &user, std::span< const std::filesystem::path > system)
Find usable assets in system roots first, then in the writable user data root.
bool PortablePathsEnabled()
std::optional< std::string > MakePortableDistribution(const GamePaths &source, const std::filesystem::path &executable, const std::filesystem::path &directory, bool copyOnly=false)
Export installed program files and platform data into a complete portable distribution.
std::function< std::optional< std::string >(const char *name)> EnvironmentReader
Reads an environment variable, or nothing when it is unset or empty.
Definition paths.h:86
constexpr std::string_view DEFAULT_PACK
The name of the asset pack of the import, the directory assets/default.
Definition paths.h:196
std::optional< GamePaths > ResolveGamePaths(const std::string &application)
Resolve the directories with the conventions of the running operating system: the XDG Base Directory ...
std::filesystem::path PortableRoot(const std::filesystem::path &executable, const std::filesystem::path &appImage={})
Locate portable files beside an application bundle, AppImage, or ordinary executable.
std::filesystem::path StorePortablePath(const std::filesystem::path &path, const std::filesystem::path &root, const std::filesystem::path &home)
Store an input path relative to the portable directory, using '~' for external home paths.
std::filesystem::path DefaultAssets(const std::filesystem::path &data)
The directory the import writes the game data to, the default pack.
Definition paths.h:191
std::optional< GamePaths > ResolveXdgPaths(const EnvironmentReader &environment, const std::string &application)
Resolve the directories with the XDG Base Directory variables and their defaults under the home direc...
std::string Utf8FromPath(const std::filesystem::path &path)
Definition paths.h:18
std::filesystem::path RestorePortablePath(const std::filesystem::path &path, const std::filesystem::path &root, const std::filesystem::path &home)
Rebuild a stored portable input path at its current executable or home location.
std::expected< GamePaths, std::string > ResolvePortablePaths(const GamePaths &fallback, const std::filesystem::path &executable, const std::filesystem::path &workingDirectory={})
Prefer adjacent configuration and assets independently when portable lookup is enabled.
std::optional< std::string > MigratePortablePaths(const GamePaths &source, const GamePaths &destination, bool copyOnly=false)
Move portable assets, settings, saves, screenshots, and state to platform directories.
std::filesystem::path PackDirectory(const std::filesystem::path &data, std::string_view pack, const std::filesystem::path &fallback={})
The directory of a pack under assets of the data directory, named after the pack.
bool CreateGamePaths(const GamePaths &paths)
Create every directory of paths that does not exist.
std::vector< std::filesystem::path > SystemDataDirectories(const std::filesystem::path &executable)
List system data roots, including the relocated installation and platform defaults.
The directories the game reads and writes, each ending in the application directory.
Definition paths.h:25
bool portableConfig
Definition paths.h:30
bool portableData
Definition paths.h:31
std::filesystem::path state
Definition paths.h:28
std::filesystem::path config
Definition paths.h:26
std::filesystem::path data
Definition paths.h:27
std::filesystem::path cache
Definition paths.h:29