Resolve symlinks for TryGetRealPath() as well
This commit is contained in:
parent
b4515bd210
commit
3f0ab45b9c
2 changed files with 29 additions and 6 deletions
|
@ -65,6 +65,29 @@ namespace Ryujinx.Common.Utilities
|
|||
return pathInfo.FullName;
|
||||
}
|
||||
|
||||
// TODO: This is bad. Resolve all data paths on startup instead.
|
||||
public static string CombineAndResolveFullPath(bool isDirectory, params string[] paths)
|
||||
{
|
||||
if (paths.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (paths.Length == 1)
|
||||
{
|
||||
return ResolveFullPath(paths[0], isDirectory);
|
||||
}
|
||||
|
||||
string fullPath = ResolveFullPath(paths[0], true);
|
||||
|
||||
for (int i = 1; i < paths.Length - 1; i++)
|
||||
{
|
||||
fullPath = ResolveFullPath(Path.Combine(fullPath, paths[i]), true);
|
||||
}
|
||||
|
||||
return ResolveFullPath(Path.Combine(fullPath, paths[^1]), isDirectory);
|
||||
}
|
||||
|
||||
public static FileInfo GetActualFileInfo(this FileInfo fileInfo)
|
||||
{
|
||||
if (fileInfo.Exists)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using LibHac.Fs;
|
||||
using LibHac.Ncm;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using System;
|
||||
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
{
|
||||
|
@ -30,11 +30,11 @@ namespace Ryujinx.HLE.FileSystem
|
|||
{
|
||||
realPath = switchContentPath switch
|
||||
{
|
||||
SystemContent => Path.Combine(AppDataManager.BaseDirPath, SystemNandPath, Contents),
|
||||
UserContent => Path.Combine(AppDataManager.BaseDirPath, UserNandPath, Contents),
|
||||
SdCardContent => Path.Combine(GetSdCardPath(), Nintendo, Contents),
|
||||
System => Path.Combine(AppDataManager.BaseDirPath, SystemNandPath),
|
||||
User => Path.Combine(AppDataManager.BaseDirPath, UserNandPath),
|
||||
SystemContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath, Contents),
|
||||
UserContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath, Contents),
|
||||
SdCardContent => FileSystemUtils.CombineAndResolveFullPath(true, GetSdCardPath(), Nintendo, Contents),
|
||||
System => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath),
|
||||
User => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue