From 2985fed3d46a0a44ce53e85b2e64fc7ceafeb0ff Mon Sep 17 00:00:00 2001 From: Attila Uygun Date: Thu, 10 Aug 2023 11:05:04 +0200 Subject: [PATCH] tmp --- src/engine/platform/platform_win.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/platform_win.cc b/src/engine/platform/platform_win.cc index c299161..fe0b27a 100644 --- a/src/engine/platform/platform_win.cc +++ b/src/engine/platform/platform_win.cc @@ -20,9 +20,22 @@ Platform::Platform(HINSTANCE instance, int cmd_show) : instance_(instance), cmd_show_(cmd_show) { LOG(0) << "Initializing platform."; - root_path_ = "./"; - data_path_ = "./"; - shared_data_path_ = "./"; + root_path_ = ".\\"; + data_path_ = ".\\"; + shared_data_path_ = ".\\"; + + char dest[MAX_PATH]; + memset(dest, 0, sizeof(dest)); + if (GetModuleFileNameA(NULL, dest, MAX_PATH) > 0) { + std::string path = dest; + std::size_t last_slash_pos = path.find_last_of('\\'); + if (last_slash_pos != std::string::npos) + path = path.substr(0, last_slash_pos + 1); + + root_path_ = path; + data_path_ = path; + shared_data_path_ = path; + } LOG(0) << "Root path: " << root_path_.c_str(); LOG(0) << "Data path: " << data_path_.c_str();