mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-20 00:46:34 +00:00
Fix opening the wrong log directory (#6220)
This commit is contained in:
parent
ccbbaddbcb
commit
4505a7f162
5 changed files with 16 additions and 9 deletions
|
@ -1352,9 +1352,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
{
|
||||
string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
|
||||
|
||||
if (ReleaseInformation.IsValid)
|
||||
if (LoggerModule.LogDirectoryPath != null)
|
||||
{
|
||||
logPath = Path.Combine(AppDataManager.BaseDirPath, "Logs");
|
||||
logPath = LoggerModule.LogDirectoryPath;
|
||||
}
|
||||
|
||||
new DirectoryInfo(logPath).Create();
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Ryujinx.Common.Logging.Targets
|
|||
public static FileStream PrepareLogFile(string path)
|
||||
{
|
||||
// Ensure directory is present
|
||||
DirectoryInfo logDir = new(Path.Combine(path, "Logs"));
|
||||
DirectoryInfo logDir = new(path);
|
||||
try
|
||||
{
|
||||
logDir.Create();
|
||||
|
|
|
@ -427,11 +427,11 @@ namespace Ryujinx.Headless.SDL2
|
|||
|
||||
if (!option.DisableFileLog)
|
||||
{
|
||||
FileStream logFile = FileLogTarget.PrepareLogFile(AppDomain.CurrentDomain.BaseDirectory);
|
||||
FileStream logFile = FileLogTarget.PrepareLogFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs"));
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
logFile = FileLogTarget.PrepareLogFile(AppDataManager.BaseDirPath);
|
||||
logFile = FileLogTarget.PrepareLogFile(Path.Combine(AppDataManager.BaseDirPath, "Logs"));
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
{
|
||||
public static class LoggerModule
|
||||
{
|
||||
public static string LogDirectoryPath { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug;
|
||||
|
@ -82,21 +84,26 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||
{
|
||||
if (e.NewValue)
|
||||
{
|
||||
FileStream logFile = FileLogTarget.PrepareLogFile(AppDomain.CurrentDomain.BaseDirectory);
|
||||
string logDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
|
||||
FileStream logFile = FileLogTarget.PrepareLogFile(logDir);
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
logFile = FileLogTarget.PrepareLogFile(AppDataManager.BaseDirPath);
|
||||
logDir = Path.Combine(AppDataManager.BaseDirPath, "Logs");
|
||||
logFile = FileLogTarget.PrepareLogFile(logDir);
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, "No writable log directory available. Make sure either the application directory or the Ryujinx directory is writable.");
|
||||
LogDirectoryPath = null;
|
||||
Logger.RemoveTarget("file");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogDirectoryPath = logDir;
|
||||
|
||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||
new FileLogTarget("file", logFile),
|
||||
1000,
|
||||
|
|
|
@ -1378,9 +1378,9 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
string logPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
|
||||
|
||||
if (ReleaseInformation.IsValid)
|
||||
if (LoggerModule.LogDirectoryPath != null)
|
||||
{
|
||||
logPath = System.IO.Path.Combine(AppDataManager.BaseDirPath, "Logs");
|
||||
logPath = LoggerModule.LogDirectoryPath;
|
||||
}
|
||||
|
||||
new DirectoryInfo(logPath).Create();
|
||||
|
|
Loading…
Reference in a new issue