Use index from end expression.

This commit is contained in:
2020-04-22 00:22:34 +01:00
parent 961f4d8652
commit 5042b7f1e8
15 changed files with 41 additions and 36 deletions

View File

@@ -465,15 +465,15 @@ namespace Aaru.Filesystems.ISO9660
return Errno.InvalidArgument;
KeyValuePair<string, DecodedDirectoryEntry> dirent =
parent.FirstOrDefault(t => t.Key.ToLower(CultureInfo.CurrentUICulture) == pieces[pieces.Length - 1]);
parent.FirstOrDefault(t => t.Key.ToLower(CultureInfo.CurrentUICulture) == pieces[^1]);
if(string.IsNullOrEmpty(dirent.Key))
{
if(!joliet &&
!pieces[pieces.Length - 1].EndsWith(";1", StringComparison.Ordinal))
!pieces[^1].EndsWith(";1", StringComparison.Ordinal))
{
dirent = parent.FirstOrDefault(t => t.Key.ToLower(CultureInfo.CurrentUICulture) ==
pieces[pieces.Length - 1] + ";1");
pieces[^1] + ";1");
if(string.IsNullOrEmpty(dirent.Key))
return Errno.NoSuchFile;