game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
platform_common.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2#include "platform/paths.h"
5
6#include <mutex>
7
8namespace platform
9{
10
11// Paths singleton
13{
14 static std::unique_ptr<Paths> instance = Paths::create();
15 return *instance;
16}
17
18bool Paths::ensureDir(const std::filesystem::path& path) const
19{
20 if (std::filesystem::exists(path))
21 {
22 return std::filesystem::is_directory(path);
23 }
24 try
25 {
26 return std::filesystem::create_directories(path);
27 }
28 catch (...)
29 {
30 return false;
31 }
32}
33
34// ProcessManager singleton
36{
37 static std::unique_ptr<ProcessManager> instance = ProcessManager::create();
38 return *instance;
39}
40
41// SteamFinder singleton
43{
44 static std::unique_ptr<SteamFinder> instance = SteamFinder::create();
45 return *instance;
46}
47
48} // namespace platform
static std::unique_ptr< Paths > create()
static Paths & instance()
virtual bool ensureDir(const std::filesystem::path &path) const
static ProcessManager & instance()
static std::unique_ptr< ProcessManager > create()
static SteamFinder & instance()
static std::unique_ptr< SteamFinder > create()