game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
paths.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2#pragma once
3
4#include <filesystem>
5#include <memory>
6#include <string>
7
8namespace platform
9{
10
11class Paths
12{
13 public:
14 virtual ~Paths() = default;
15
16 // Application directories
17 virtual std::filesystem::path getDataDir()
18 const = 0; // Config, database (~/.local/share/gamelauncher or %APPDATA%/GameLauncher)
19 virtual std::filesystem::path getCacheDir()
20 const = 0; // Temporary cache (~/.cache/gamelauncher or %LOCALAPPDATA%/GameLauncher/cache)
21 virtual std::filesystem::path getLogDir() const = 0; // Log files
22
23 // User directories
24 virtual std::filesystem::path getHomeDir() const = 0;
25 virtual std::filesystem::path getDocumentsDir() const = 0;
26
27 // Expand environment variables in path (e.g., $HOME or %USERPROFILE%)
28 virtual std::filesystem::path expandPath(const std::string& path) const = 0;
29
30 // Ensure directory exists (creates if needed)
31 virtual bool ensureDir(const std::filesystem::path& path) const;
32
33 // Factory - creates platform-specific implementation
34 static std::unique_ptr<Paths> create();
35
36 // Singleton access for convenience
37 static Paths& instance();
38};
39
40} // namespace platform
virtual std::filesystem::path getCacheDir() const =0
virtual ~Paths()=default
static std::unique_ptr< Paths > create()
static Paths & instance()
virtual std::filesystem::path expandPath(const std::string &path) const =0
virtual std::filesystem::path getDocumentsDir() const =0
virtual bool ensureDir(const std::filesystem::path &path) const
virtual std::filesystem::path getLogDir() const =0
virtual std::filesystem::path getDataDir() const =0
virtual std::filesystem::path getHomeDir() const =0