Skip to content

Commit

Permalink
minor pedantic refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed Nov 18, 2021
1 parent 432f276 commit 07559c7
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,16 @@ public static void CreateDirectory(string fullPath)
}
}

public static void CreateParentsAndDirectory(string fullPath, ValueListBuilder<int> stackDir)
private static void CreateParentsAndDirectory(string fullPath, ValueListBuilder<int> stackDir)
{
stackDir.Append(fullPath.Length);

int i = fullPath.Length - 1;
// Trim trailing separator.
if (PathInternal.IsDirectorySeparator(fullPath[i]))
{
i--;
i--; // Trim trailing separator.
}

do
{
// Find the end of the parent directory.
Expand All @@ -337,13 +337,11 @@ public static void CreateParentsAndDirectory(string fullPath, ValueListBuilder<i
i--;
}

// Try create it.
ReadOnlySpan<char> mkdirPath = fullPath.AsSpan(0, i);
int result = Interop.Sys.MkDir(mkdirPath, (int)Interop.Sys.Permissions.Mask);
if (result == 0)
{
// Created parent.
break;
break; // Created parent.
}

Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
Expand Down

0 comments on commit 07559c7

Please sign in to comment.