Throw an exception instead of returning null for SwitchPathToSystemPath and GetFullPath

This commit is contained in:
TSR Berry 2024-07-11 00:43:27 +02:00
parent eab85667e1
commit d3d08ae136
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -98,14 +98,14 @@ namespace Ryujinx.HLE.FileSystem
}
else
{
return null;
throw new ArgumentException($"The filename does not start with '/': {fileName}", nameof(fileName));
}
string fullPath = Path.GetFullPath(Path.Combine(basePath, fileName));
if (!fullPath.StartsWith(AppDataManager.BaseDirPath))
{
return null;
throw new ArgumentException($"The path is not located inside the Ryujinx directory: {fullPath}", nameof(basePath));
}
return fullPath;
@ -120,7 +120,7 @@ namespace Ryujinx.HLE.FileSystem
if (parts.Length != 2)
{
return null;
throw new ArgumentException($"Invalid switch fs path provided: {switchPath}", nameof(switchPath));
}
return GetFullPath(MakeFullPath(parts[0]), parts[1]);