Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
PlatformUtils.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
27
28#pragma once
29
30#include <string>
31#include <ctime>
32
33namespace RoR {
34
37
38extern char PATH_SLASH;
39
40bool FileExists(const char* path);
41bool FolderExists(const char* path);
42void CreateFolder(const char* path);
43
44inline bool FileExists(std::string const& path) { return FileExists(path.c_str()); }
45inline bool FolderExists(std::string const& path) { return FolderExists(path.c_str()); }
46inline void CreateFolder(std::string const& path) { CreateFolder(path.c_str()); }
47
48inline std::string PathCombine(std::string a, std::string b) { return a + PATH_SLASH + b; };
49
50std::string GetUserHomeDirectory();
51std::string GetExecutablePath();
52std::string GetParentDirectory(const char* path);
53
54std::time_t GetFileLastModifiedTime(std::string const & path);
55
56void OpenUrlInDefaultBrowser(std::string const& url);
57
59
60} // namespace RoR
std::time_t GetFileLastModifiedTime(std::string const &path)
void CreateFolder(const char *path)
Path must be UTF-8 encoded.
std::string GetExecutablePath()
Returns UTF-8 path or empty string on error.
std::string GetUserHomeDirectory()
Returns UTF-8 path or empty string on error.
void OpenUrlInDefaultBrowser(std::string const &url)
bool FolderExists(const char *path)
Path must be UTF-8 encoded.
char PATH_SLASH
std::string GetParentDirectory(const char *src_buff)
Returns UTF-8 path without trailing slash.
std::string PathCombine(std::string a, std::string b)
bool FileExists(const char *path)
Path must be UTF-8 encoded.