Fix Unix implementation of IsSubfolderOf

This commit is contained in:
YoshiRulz 2021-01-29 10:27:58 +10:00
parent ec80d0fb1d
commit 7763d7a1cd
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 3 additions and 2 deletions

View File

@ -20,8 +20,9 @@ namespace BizHawk.Common.PathExtensions
if (OSTailoredCode.IsUnixHost) if (OSTailoredCode.IsUnixHost)
{ {
#if true #if true
return OSTailoredCode.SimpleSubshell("realpath", $"-L \"{childPath}\"", $"invalid path {childPath} or missing realpath binary") var c = OSTailoredCode.SimpleSubshell("realpath", $"-Lm \"{childPath}\"", $"invalid path {childPath} or missing realpath binary");
.StartsWith(OSTailoredCode.SimpleSubshell("realpath", $"-L \"{parentPath}\"", $"invalid path {parentPath} or missing realpath binary")); var p = OSTailoredCode.SimpleSubshell("realpath", $"-Lm \"{parentPath}\"", $"invalid path {parentPath} or missing realpath binary");
return c == p || c.StartsWith($"{p}/");
#else // written for Unix port but may be useful for Windows when moving to .NET Core #else // written for Unix port but may be useful for Windows when moving to .NET Core
var parentUriPath = new Uri(parentPath.TrimEnd('.')).AbsolutePath.TrimEnd('/'); var parentUriPath = new Uri(parentPath.TrimEnd('.')).AbsolutePath.TrimEnd('/');
try try