Correct MFS behaviour when path starts with directory separator.

This commit is contained in:
2018-10-24 21:44:18 +01:00
parent b25d32d2cc
commit 99d98f2201
2 changed files with 12 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
@@ -85,6 +87,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
@@ -155,6 +159,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
path = pathElements[0];
if(debug)
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
@@ -239,6 +245,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;