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;
|
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)
|
public static FileInfo GetActualFileInfo(this FileInfo fileInfo)
|
||||||
{
|
{
|
||||||
if (fileInfo.Exists)
|
if (fileInfo.Exists)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using LibHac.Fs;
|
using LibHac.Fs;
|
||||||
using LibHac.Ncm;
|
using LibHac.Ncm;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Common.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
|
using static Ryujinx.HLE.FileSystem.VirtualFileSystem;
|
||||||
using Path = System.IO.Path;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.FileSystem
|
namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
|
@ -30,11 +30,11 @@ namespace Ryujinx.HLE.FileSystem
|
||||||
{
|
{
|
||||||
realPath = switchContentPath switch
|
realPath = switchContentPath switch
|
||||||
{
|
{
|
||||||
SystemContent => Path.Combine(AppDataManager.BaseDirPath, SystemNandPath, Contents),
|
SystemContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath, Contents),
|
||||||
UserContent => Path.Combine(AppDataManager.BaseDirPath, UserNandPath, Contents),
|
UserContent => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath, Contents),
|
||||||
SdCardContent => Path.Combine(GetSdCardPath(), Nintendo, Contents),
|
SdCardContent => FileSystemUtils.CombineAndResolveFullPath(true, GetSdCardPath(), Nintendo, Contents),
|
||||||
System => Path.Combine(AppDataManager.BaseDirPath, SystemNandPath),
|
System => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, SystemNandPath),
|
||||||
User => Path.Combine(AppDataManager.BaseDirPath, UserNandPath),
|
User => FileSystemUtils.CombineAndResolveFullPath(true, AppDataManager.BaseDirPath, UserNandPath),
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue