2017-04-01 14:38:52 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2018-06-15 14:07:34 +02:00
|
|
|
*
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
|
|
*****************************************************************************/
|
2017-04-01 14:38:52 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-06-22 23:04:38 +02:00
|
|
|
#include "../common.h"
|
2020-06-28 21:46:14 +02:00
|
|
|
#include "platform.h"
|
2018-06-22 23:04:38 +02:00
|
|
|
|
2018-01-07 21:27:30 +01:00
|
|
|
#include <ctime>
|
2017-11-28 21:57:34 +01:00
|
|
|
#include <string>
|
2017-04-01 14:38:52 +02:00
|
|
|
|
2017-11-28 21:57:34 +01:00
|
|
|
enum class SPECIAL_FOLDER
|
|
|
|
{
|
|
|
|
USER_CACHE,
|
|
|
|
USER_CONFIG,
|
|
|
|
USER_DATA,
|
|
|
|
USER_HOME,
|
2018-10-25 11:57:19 +02:00
|
|
|
|
|
|
|
RCT2_DISCORD,
|
2017-11-28 21:57:34 +01:00
|
|
|
};
|
|
|
|
|
2017-04-01 14:38:52 +02:00
|
|
|
namespace Platform
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t GetTicks();
|
2018-06-22 23:04:38 +02:00
|
|
|
std::string GetEnvironmentVariable(const std::string& name);
|
2017-11-28 21:57:34 +01:00
|
|
|
std::string GetFolderPath(SPECIAL_FOLDER folder);
|
|
|
|
std::string GetInstallPath();
|
2018-01-21 03:13:32 +01:00
|
|
|
std::string GetDocsPath();
|
2017-12-02 00:48:46 +01:00
|
|
|
std::string GetCurrentExecutablePath();
|
2020-08-27 21:03:41 +02:00
|
|
|
std::string GetCurrentExecutableDirectory();
|
2020-07-02 17:03:31 +02:00
|
|
|
bool FileExists(const std::string path);
|
2021-03-26 03:45:01 +01:00
|
|
|
bool IsPathSeparator(char c);
|
2021-03-26 03:51:33 +01:00
|
|
|
utf8* GetAbsolutePath(utf8* buffer, size_t bufferSize, const utf8* relativePath);
|
2020-11-23 04:23:07 +01:00
|
|
|
uint64_t GetLastModified(const std::string& path);
|
2020-06-28 21:46:14 +02:00
|
|
|
rct2_time GetTimeLocal();
|
|
|
|
rct2_date GetDateLocal();
|
2020-10-22 21:17:28 +02:00
|
|
|
bool FindApp(const std::string& app, std::string* output);
|
|
|
|
int32_t Execute(const std::string& command, std::string* output = nullptr);
|
2017-12-01 01:54:03 +01:00
|
|
|
|
|
|
|
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
2018-06-22 23:04:38 +02:00
|
|
|
std::string GetEnvironmentPath(const char* name);
|
2017-12-01 01:54:03 +01:00
|
|
|
std::string GetHomePath();
|
|
|
|
#endif
|
2018-01-07 21:27:30 +01:00
|
|
|
|
|
|
|
std::string FormatShortDate(std::time_t timestamp);
|
|
|
|
std::string FormatTime(std::time_t timestamp);
|
2018-03-12 19:00:35 +01:00
|
|
|
|
2018-05-23 20:42:42 +02:00
|
|
|
#ifdef _WIN32
|
2018-06-20 17:28:51 +02:00
|
|
|
bool IsOSVersionAtLeast(uint32_t major, uint32_t minor, uint32_t build);
|
2020-06-23 22:58:40 +02:00
|
|
|
void SetUpFileAssociations();
|
|
|
|
bool SetUpFileAssociation(
|
2021-01-06 17:22:22 +01:00
|
|
|
std::string_view extension, std::string_view fileTypeText, std::string_view commandText, std::string_view commandArgs,
|
|
|
|
const uint32_t iconIndex);
|
2020-08-25 23:20:24 +02:00
|
|
|
void RemoveFileAssociations();
|
2018-05-23 20:42:42 +02:00
|
|
|
#endif
|
|
|
|
|
2020-04-23 19:12:54 +02:00
|
|
|
bool IsRunningInWine();
|
2018-03-12 19:00:35 +01:00
|
|
|
bool IsColourTerminalSupported();
|
2020-01-04 12:44:40 +01:00
|
|
|
bool HandleSpecialCommandLineArgument(const char* argument);
|
2020-07-11 18:56:12 +02:00
|
|
|
utf8* StrDecompToPrecomp(utf8* input);
|
2018-05-04 22:40:09 +02:00
|
|
|
} // namespace Platform
|