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
"
3
#include "
platform/process_manager.h
"
4
#include "
platform/steam_finder.h
"
5
6
#include <mutex>
7
8
namespace
platform
9
{
10
11
// Paths singleton
12
Paths
&
Paths::instance
()
13
{
14
static
std::unique_ptr<Paths>
instance
=
Paths::create
();
15
return
*
instance
;
16
}
17
18
bool
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
35
ProcessManager
&
ProcessManager::instance
()
36
{
37
static
std::unique_ptr<ProcessManager>
instance
=
ProcessManager::create
();
38
return
*
instance
;
39
}
40
41
// SteamFinder singleton
42
SteamFinder
&
SteamFinder::instance
()
43
{
44
static
std::unique_ptr<SteamFinder>
instance
=
SteamFinder::create
();
45
return
*
instance
;
46
}
47
48
}
// namespace platform
platform::Paths
Definition
paths.h:12
platform::Paths::create
static std::unique_ptr< Paths > create()
platform::Paths::instance
static Paths & instance()
Definition
platform_common.cpp:12
platform::Paths::ensureDir
virtual bool ensureDir(const std::filesystem::path &path) const
Definition
platform_common.cpp:18
platform::ProcessManager
Definition
process_manager.h:25
platform::ProcessManager::instance
static ProcessManager & instance()
Definition
platform_common.cpp:35
platform::ProcessManager::create
static std::unique_ptr< ProcessManager > create()
platform::SteamFinder
Definition
steam_finder.h:21
platform::SteamFinder::instance
static SteamFinder & instance()
Definition
platform_common.cpp:42
platform::SteamFinder::create
static std::unique_ptr< SteamFinder > create()
platform
Definition
paths.h:9
paths.h
process_manager.h
steam_finder.h
core
src
platform
platform_common.cpp
Generated by
1.16.1