From c080a592f41503d1d26dc829e28ca7ded5138c30 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Sun, 9 Feb 2025 17:35:23 +0100 Subject: [PATCH] Don't change working directory to exe location on non-Windows Signed-off-by: magic_rb --- Source/Server/Entry.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Server/Entry.cpp b/Source/Server/Entry.cpp index 7f57469a..43fdfa95 100644 --- a/Source/Server/Entry.cpp +++ b/Source/Server/Entry.cpp @@ -72,10 +72,14 @@ int main(int argc, char* argv[]) std::string mode_arg = argc > 1 ? argv[1] : ""; start_as_client_emulator = (mode_arg == "-client_emulator"); + // only do this on Windows, on Linux its very common to not have writable + // access to wherever the binary is installed + #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) // Switch working directory to the same directory the // exe is inside of. Prevents wierdness when we start from visual studio etc. std::filesystem::path exe_directory = std::filesystem::path(argv[0]).parent_path(); std::filesystem::current_path(exe_directory); + #endif Log(R"--( ____ __ _____ __ )--"); Log(R"--( / __ \____ ______/ /__ / ___/____ __ __/ /____)--"); @@ -174,4 +178,4 @@ int main(int argc, char* argv[]) } return 0; -} \ No newline at end of file +}