diff options
author | jcm <john.moody@coloradocollege.edu> | 2024-02-10 19:17:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-11 02:17:19 +0100 |
commit | 84d6e8d121a1b329d26cc0e462aadd1108d99a04 (patch) | |
tree | f50072df2ffa3f86697aa7859185f71e1df7412e /src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs | |
parent | 95c4912d58a535de4f5c03a2e380bdd39a543c12 (diff) |
Standardize logging locations across desktop platforms (#6238)1.1.1186
* Standardize logging locations across desktop platforms
* Return null instead of empty literal on exceptions
* Remove LogDirectoryPath from LoggerModule
* Catch exception when creating DirectoryInfo in FileLogTarget
* Remove redundant log path vars, handle exception better, add null check
* Address styling issues
* Remove extra newline, quote file path in log, move directory check to OpenHelper
* Add GetOrCreateLogsDir to get/create log directory during runtime
* misc format changes
* Update src/Ryujinx.Common/Configuration/AppDataManager.cs
---------
Co-authored-by: jcm <butt@butts.com>
Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs')
-rw-r--r-- | src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs b/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs index a4e8f714..8d4ede96 100644 --- a/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs +++ b/src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs @@ -23,7 +23,18 @@ namespace Ryujinx.Common.Logging.Targets public static FileStream PrepareLogFile(string path) { // Ensure directory is present - DirectoryInfo logDir = new(path); + DirectoryInfo logDir; + try + { + logDir = new DirectoryInfo(path); + } + catch (ArgumentException exception) + { + Logger.Warning?.Print(LogClass.Application, $"Logging directory path ('{path}') was invalid: {exception}"); + + return null; + } + try { logDir.Create(); |