Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
special_dir.hpp
Go to the documentation of this file.
1#pragma once
2
48
49#include <array>
50#include <filesystem>
51#include <functional>
52#include <optional>
53#include <string>
54#include <string_view>
55
56namespace pulp::platform {
57
73
89
91std::string_view special_dir_name(SpecialDir kind) noexcept;
92
94std::filesystem::path special_dir(SpecialDir kind);
95
99void set_special_dir_override(SpecialDir kind, std::filesystem::path path);
101
102// ── Pure resolver ───────────────────────────────────────────────────────────
103
107
110
116 std::function<std::optional<std::string>(std::string_view)> getenv;
117 std::string executable;
118 std::string module;
119 std::string known_documents;
120 std::string known_desktop;
121 std::string known_music;
122 std::string android_files_dir;
123 std::string android_cache_dir;
124};
125
127std::string special_dir_for(SpecialDirOs os, SpecialDir kind, const SpecialDirInputs& inputs);
128
129} // namespace pulp::platform
Definition chord.hpp:14
Device capability vocabulary: one tier ladder, one thermal ladder, and the projection from observed i...
Definition child_process.hpp:15
SpecialDir
Definition special_dir.hpp:58
@ cache
Definition special_dir.hpp:67
@ home
Definition special_dir.hpp:59
@ music
Definition special_dir.hpp:62
@ current_executable
Definition special_dir.hpp:69
@ logs
Definition special_dir.hpp:68
@ documents
Definition special_dir.hpp:60
@ config
Per-user settings root (an XDG distinction; equals app_data off Linux).
Definition special_dir.hpp:65
@ temp
Definition special_dir.hpp:66
@ app_data_shared
Application data shared by every user of the machine.
Definition special_dir.hpp:64
@ app_data
Per-user application data.
Definition special_dir.hpp:63
@ user_presets
Definition special_dir.hpp:71
@ bundle_dir
Definition special_dir.hpp:70
@ desktop
Definition special_dir.hpp:61
std::string_view special_dir_name(SpecialDir kind) noexcept
Stable lower_snake_case name, for diagnostics and tests.
void set_special_dir_override(SpecialDir kind, std::filesystem::path path)
Replace the resolved location for kind (a mobile host that learns its sandbox paths late,...
constexpr std::array< SpecialDir, 13 > kAllSpecialDirs
Definition special_dir.hpp:74
SpecialDirOs
Operating system a path is shaped for.
Definition special_dir.hpp:106
@ windows
Definition special_dir.hpp:106
@ web
Definition special_dir.hpp:106
@ macos
Definition special_dir.hpp:106
@ ios
Definition special_dir.hpp:106
@ android
Definition special_dir.hpp:106
@ linux_desktop
Definition special_dir.hpp:106
SpecialDirOs host_special_dir_os() noexcept
The host OS this binary was built for.
std::string special_dir_for(SpecialDirOs os, SpecialDir kind, const SpecialDirInputs &inputs)
Resolve kind for os from inputs alone. Empty string when unavailable.
void clear_special_dir_overrides()
std::filesystem::path special_dir(SpecialDir kind)
Resolve kind for the running process. Empty when unavailable.
Everything the resolver may read, so every platform's layout can be computed (and tested) on any host...
Definition special_dir.hpp:114
std::string known_desktop
Definition special_dir.hpp:120
std::function< std::optional< std::string >(std::string_view)> getenv
Environment lookup; an unset or empty variable returns nullopt/empty.
Definition special_dir.hpp:116
std::string known_documents
Windows known-folder overrides, else derived.
Definition special_dir.hpp:119
std::string executable
Absolute path of the running executable.
Definition special_dir.hpp:117
std::string known_music
Definition special_dir.hpp:121
std::string android_cache_dir
Optional; defaults to <files>/cache.
Definition special_dir.hpp:123
std::string module
Absolute path of the binary holding this code.
Definition special_dir.hpp:118
std::string android_files_dir
From the app-data-dir hook.
Definition special_dir.hpp:122