From 1e78eefa03fa6c18199c484d6f538a7726312f52 Mon Sep 17 00:00:00 2001 From: Pengfei Date: Fri, 10 Sep 2021 22:09:21 +0800 Subject: [PATCH] Fix log file path --- src/common/common_paths.h | 2 +- src/common/logging/log.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/common_paths.h b/src/common/common_paths.h index de6753f..fce54e5 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -25,7 +25,7 @@ #endif #define CITRA_EXECUTABLE "citra-qt" -#define LOG_FILE "threeSD.log.txt" +#define LOG_FILE "threeSD_log.txt" // Subdirs in the User dir returned by GetUserPath(UserPath::UserDir) #define CONFIG_DIR "config" diff --git a/src/common/logging/log.cpp b/src/common/logging/log.cpp index dd0bdb0..3b8aee0 100644 --- a/src/common/logging/log.cpp +++ b/src/common/logging/log.cpp @@ -6,8 +6,6 @@ #include #ifdef _WIN32 #include // For _SH_DENYWR -#else -#define _SH_DENYWR 0 #endif #include "common/common_paths.h" @@ -24,8 +22,12 @@ std::uint64_t GetLoggingTime() { .count(); } -// _SH_DENYWR allows read-only access for other programs. For non-Windows it's defined to 0. -static FileUtil::IOFile g_log_file{LOG_FILE, "w", _SH_DENYWR}; +#ifdef __WIN32 +// _SH_DENYWR allows read-only access for other programs. +static FileUtil::IOFile g_log_file{FileUtil::GetExeDirectory() + DIR_SEP LOG_FILE, "w", _SH_DENYWR}; +#else +static FileUtil::IOFile g_log_file{ROOT_DIR DIR_SEP LOG_FILE, "w"}; +#endif static std::array g_error_buffer{}; static int g_error_buffer_pos = 0;