mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-11-22 00:51:16 +00:00
UI: App Library: automatically remove nonexistent autoload/game dirs from the configuration upon load.
This commit is contained in:
parent
4677b749b1
commit
49c70efdd5
@ -11,6 +11,7 @@ using Ryujinx.Common.Logging;
|
|||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||||||
RyuLogger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {cff.Version}, loading default.");
|
RyuLogger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {cff.Version}, loading default.");
|
||||||
|
|
||||||
LoadDefault();
|
LoadDefault();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((int newVersion, Action<ConfigurationFileFormat> migratorFunction)
|
foreach ((int newVersion, Action<ConfigurationFileFormat> migratorFunction)
|
||||||
@ -167,14 +169,53 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||||||
DirtyHacks hacks = new(cff.DirtyHacks ?? []);
|
DirtyHacks hacks = new(cff.DirtyHacks ?? []);
|
||||||
|
|
||||||
Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix);
|
Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configurationFileUpdated)
|
List<string> existingDirs = [];
|
||||||
|
bool didPathUpdate = false;
|
||||||
|
|
||||||
|
{ // Game dirs
|
||||||
|
foreach (var gameDir in UI.GameDirs.Value)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(gameDir))
|
||||||
|
{
|
||||||
|
existingDirs.Add(gameDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RyuLogger.Warning?.Print(LogClass.Configuration, $"Path '{gameDir}' seems to no longer exist. Removing it from game directory configuration.");
|
||||||
|
didPathUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UI.GameDirs.Value = existingDirs.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
existingDirs.Clear();
|
||||||
|
|
||||||
|
{ // Autoload dirs
|
||||||
|
foreach (var autoloadDir in UI.AutoloadDirs.Value)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(autoloadDir))
|
||||||
|
{
|
||||||
|
existingDirs.Add(autoloadDir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RyuLogger.Warning?.Print(LogClass.Configuration, $"Path '{autoloadDir}' seems to no longer exist. Removing it from auto load directory configuration.");
|
||||||
|
didPathUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UI.AutoloadDirs.Value = existingDirs.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configurationFileUpdated || didPathUpdate)
|
||||||
{
|
{
|
||||||
ToFileFormat().SaveConfig(configurationFilePath);
|
ToFileFormat().SaveConfig(configurationFilePath);
|
||||||
|
|
||||||
RyuLogger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
|
if (configurationFileUpdated)
|
||||||
|
RyuLogger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -481,7 +481,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
if (Program.PreviewerDetached)
|
if (Program.PreviewerDetached)
|
||||||
{
|
{
|
||||||
Task.Run(LoadTimeZones);
|
Task.Run(LoadTimeZones);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user