temp: Attempt to solve missing paths + add logging
This commit is contained in:
parent
3f0ab45b9c
commit
8381bc7220
4 changed files with 21 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -59,9 +60,15 @@ namespace Ryujinx.Common.Utilities
|
||||||
|
|
||||||
if (pathInfo.Exists)
|
if (pathInfo.Exists)
|
||||||
{
|
{
|
||||||
return pathInfo.ResolveLinkTarget(true)?.FullName ?? pathInfo.FullName;
|
var fullPath = pathInfo.ResolveLinkTarget(true)?.FullName ?? pathInfo.FullName;
|
||||||
|
|
||||||
|
Logger.Warning?.Print(LogClass.Application, $"Resolved: {path} -> {pathInfo.FullName}");
|
||||||
|
|
||||||
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.Warning?.Print(LogClass.Application, $"Can't resolve non-existent path: {path} -> {pathInfo.FullName}");
|
||||||
|
|
||||||
return pathInfo.FullName;
|
return pathInfo.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +92,11 @@ namespace Ryujinx.Common.Utilities
|
||||||
fullPath = ResolveFullPath(Path.Combine(fullPath, paths[i]), true);
|
fullPath = ResolveFullPath(Path.Combine(fullPath, paths[i]), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResolveFullPath(Path.Combine(fullPath, paths[^1]), isDirectory);
|
fullPath = ResolveFullPath(Path.Combine(fullPath, paths[^1]), isDirectory);
|
||||||
|
|
||||||
|
Logger.Warning?.Print(LogClass.Application, $"Combined and resolved: {fullPath}");
|
||||||
|
|
||||||
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileInfo GetActualFileInfo(this FileInfo fileInfo)
|
public static FileInfo GetActualFileInfo(this FileInfo fileInfo)
|
||||||
|
|
|
@ -30,11 +30,11 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
realPath = switchContentPath switch
|
realPath = switchContentPath switch
|
||||||
{
|
{
|
||||||
SystemContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath, Contents),
|
SystemContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, AppDataManager.DefaultNandDir, "system", Contents),
|
||||||
UserContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath, Contents),
|
UserContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, AppDataManager.DefaultNandDir, "user", Contents),
|
||||||
SdCardContent => FileSystemUtils.CombineAndResolveFullPath(true, GetSdCardPath(), Nintendo, Contents),
|
SdCardContent => FileSystemUtils.CombineAndResolveFullPath(true, GetSdCardPath(), Nintendo, Contents),
|
||||||
System => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath),
|
System => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, AppDataManager.DefaultNandDir, "system"),
|
||||||
User => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath),
|
User => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, AppDataManager.DefaultNandDir, "user"),
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -179,11 +179,11 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fullPath = Path.Combine(AppDataManager.BaseDirPath, path);
|
string fullPath = FileSystemUtils.CombineAndResolveFullPath(isDirectory, AppDataManager.BaseDirPath, path);
|
||||||
|
|
||||||
if (isDirectory && !Directory.Exists(fullPath))
|
if (isDirectory && !Directory.Exists(fullPath))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(fullPath);
|
Directory.CreateDirectory(fullPath!);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fullPath;
|
return fullPath;
|
||||||
|
|
|
@ -395,7 +395,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
configurationFileFormat = JsonHelper.DeserializeFromFile(path, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
configurationFileFormat = JsonHelper.DeserializeFromFile(FileSystemUtils.ResolveFullPath(path, false), ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||||
|
|
||||||
return configurationFileFormat.Version != 0;
|
return configurationFileFormat.Version != 0;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// <param name="path">The path to the JSON configuration file</param>
|
/// <param name="path">The path to the JSON configuration file</param>
|
||||||
public void SaveConfig(string path)
|
public void SaveConfig(string path)
|
||||||
{
|
{
|
||||||
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
JsonHelper.SerializeToFile(FileSystemUtils.ResolveFullPath(path, false), this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue