mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 04:11:36 +00:00
fixed paths
This commit is contained in:
parent
13c0146b42
commit
2873fac43a
5 changed files with 20 additions and 30 deletions
|
|
@ -4,10 +4,6 @@ if (WIN32)
|
|||
option(UNLEASHED_RECOMP_D3D12 "Add D3D12 support for rendering" ON)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
option(UNLEASHED_RECOMP_FLATPAK "Configure the build for Flatpak compatibility." OFF)
|
||||
endif()
|
||||
|
||||
function(BIN2C)
|
||||
cmake_parse_arguments(BIN2C_ARGS "" "TARGET_OBJ;SOURCE_FILE;DEST_FILE;ARRAY_NAME;COMPRESSION_TYPE" "" ${ARGN})
|
||||
|
||||
|
|
@ -300,13 +296,6 @@ else()
|
|||
add_executable(UnleashedRecomp ${UNLEASHED_RECOMP_CXX_SOURCES})
|
||||
endif()
|
||||
|
||||
if (UNLEASHED_RECOMP_FLATPAK)
|
||||
target_compile_definitions(UnleashedRecomp PRIVATE
|
||||
"UNLEASHED_RECOMP_FLATPAK"
|
||||
"GAME_INSTALL_DIRECTORY_PREPROC=\"/var/data\""
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNLEASHED_RECOMP_D3D12)
|
||||
find_package(directx-headers CONFIG REQUIRED)
|
||||
find_package(directx12-agility CONFIG REQUIRED)
|
||||
|
|
|
|||
|
|
@ -5,15 +5,16 @@
|
|||
|
||||
std::vector<IConfigDef*> g_configDefinitions;
|
||||
|
||||
const bool g_isRuntimeFlatpak =
|
||||
#if defined(__linux__)
|
||||
getenv("FLATPAK_SANDBOX_DIR") != nullptr;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
#define CONFIG_DEFINE_ENUM_TEMPLATE(type) \
|
||||
static std::unordered_map<std::string, type> g_##type##_template =
|
||||
|
||||
#if defined(__linux__)
|
||||
const bool g_isRuntimeFlatpak = getenv("FLATPAK_SANDBOX_DIR") != nullptr;
|
||||
#else
|
||||
const bool g_isRuntimeFlatpak = false;
|
||||
#endif
|
||||
|
||||
CONFIG_DEFINE_ENUM_TEMPLATE(ELanguage)
|
||||
{
|
||||
{ "English", ELanguage::English },
|
||||
|
|
|
|||
|
|
@ -4,32 +4,36 @@
|
|||
|
||||
std::filesystem::path g_executableRoot = os::process::GetExecutablePath().remove_filename();
|
||||
std::filesystem::path g_userPath = BuildUserPath();
|
||||
extern const std::string g_gamepath = GetGamePath().string();
|
||||
extern const std::string g_gamepath = GetGamePath();
|
||||
|
||||
bool CheckPortable()
|
||||
{
|
||||
return std::filesystem::exists(g_executableRoot / "portable.txt");
|
||||
}
|
||||
|
||||
std::filesystem::path GetGamePath()
|
||||
std::string GetGamePath()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
if (g_isRuntimeFlatpak || CheckPortable())
|
||||
return GAME_INSTALL_DIRECTORY_PREPROC;
|
||||
if (g_isRuntimeFlatpak)
|
||||
return "/var/data";
|
||||
|
||||
if (CheckPortable())
|
||||
return g_executableRoot.string();
|
||||
|
||||
const char* homeDir = getenv("HOME");
|
||||
|
||||
if (homeDir == nullptr)
|
||||
{
|
||||
return GAME_INSTALL_DIRECTORY_PREPROC;
|
||||
return g_executableRoot.string();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::filesystem::path homePath = homeDir;
|
||||
std::filesystem::path gamePath = homePath / ".local/share" / USER_DIRECTORY;
|
||||
return gamePath;
|
||||
return gamePath.string();
|
||||
}
|
||||
#else
|
||||
return GAME_INSTALL_DIRECTORY_PREPROC;
|
||||
return ".";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,15 +4,11 @@
|
|||
|
||||
#define USER_DIRECTORY "UnleashedRecomp"
|
||||
|
||||
#ifndef GAME_INSTALL_DIRECTORY_PREPROC
|
||||
#define GAME_INSTALL_DIRECTORY_PREPROC "."
|
||||
#endif
|
||||
|
||||
bool CheckPortable();
|
||||
std::filesystem::path BuildUserPath();
|
||||
const std::filesystem::path& GetUserPath();
|
||||
extern const std::string g_gamepath;
|
||||
std::filesystem::path GetGamePath();
|
||||
std::string GetGamePath();
|
||||
|
||||
inline std::filesystem::path GetSavePath(bool checkForMods)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"name": "UnleashedRecomp",
|
||||
"buildsystem": "simple",
|
||||
"build-commands": [
|
||||
"cmake --preset linux-release -DUNLEASHED_RECOMP_FLATPAK=ON -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache",
|
||||
"cmake --preset linux-release -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache",
|
||||
"cmake --build out/build/linux-release --target UnleashedRecomp",
|
||||
"mkdir -p /app/bin",
|
||||
"cp out/build/linux-release/UnleashedRecomp/UnleashedRecomp /app/bin/UnleashedRecomp",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue