Write log file to OS-standard location instead of game directory#113
Write log file to OS-standard location instead of game directory#113MBurchard wants to merge 1 commit intonetniV:mainfrom
Conversation
The log file was placed in the game's working directory, making it hard to find when debugging. - macOS: ~/Library/Logs/com.stfcmod.startrekpatch/, Windows: %LOCALAPPDATA%/stfcmod/Logs/ - Create log directory on startup if it does not exist, keep existing behaviour for -ccm override - Add ShlObj.h include for SHGetKnownFolderPath on Windows
44d0b8f to
cbcaf63
Compare
|
I'd probably prefer if this were MacOS only, the windows Mod just dumping in the same place as version.dll is fine. |
|
I disagree on principle. Log files shouldn't pollute the game directory on any platform. On Windows, %LOCALAPPDATA% is the standard location for application logs and avoids permission issues with Program Files paths. That said, I don't want to hold up your work on #111. If you'd rather keep the Windows log path as-is, I'll close this PR and leave it to you. |
|
Oh I'm not gonna touch the logging code at all. I'll leave this one up to @netniV |
|
When using the -ccm option, the log files are placed in the same directory as the toml file. This is our standard and makes life easier when requesting details from users who do not know what they are doing. So, whilst %appdata% may be standard for data under windows, I'm not convinced on making that change just yet. But please try to convince me why that's important to move, and I may change my mind. |
Summary
The log file was written relative to the game's working directory, making it hard to find when debugging user-reported issues. This PR writes the log to OS-standard locations:
~/Library/Logs/com.stfcmod.startrekpatch/community_patch.log%LOCALAPPDATA%\stfcmod\Logs\community_patch.logThe log directory is created automatically on startup. The
-ccmcommand line override continues to work as before.Changes
file.cc: Platform-specific log path calculation in the default (non-override) casefile.h: AddShlObj.hinclude forSHGetKnownFolderPathon WindowsTest plan
xmake buildsucceeds on macOS (arm64)~/Library/Logs/com.stfcmod.startrekpatch/community_patch.log