Skip to content

Commit

Permalink
Update VirtualizedRunHelper.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 4, 2024
1 parent 7dc99a9 commit 794b55b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Verify/VirtualizedRunHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ static bool TryGetRelative(
codeBaseRootAbsolute = currentDir;
return true;
}
} while (TryRemoveDirFromEndOfPath(ref currentDir));

currentDir = TryRemoveDirFromEndOfPath(currentDir);
} while (currentDir.Length > 0);
} while (TryRemoveDirFromStartOfPath(ref buildTimePathRelative));

codeBaseRootAbsolute = null;
Expand Down Expand Up @@ -233,11 +235,11 @@ static bool TryRemoveDirFromStartOfPath(ref string path)
return path != string.Empty;
}

static bool TryRemoveDirFromEndOfPath(ref string path)
static string TryRemoveDirFromEndOfPath(string path)
{
if (path == string.Empty)
{
return false;
return string.Empty;
}

path = path.TrimEnd(separators);
Expand All @@ -246,11 +248,11 @@ static bool TryRemoveDirFromEndOfPath(ref string path)
if (nextSeparatorIdx <= 0 ||
nextSeparatorIdx == path.Length - 1)
{
return false;
return string.Empty;
}

path = path[..nextSeparatorIdx];

return path != string.Empty;
return path;
}
}

0 comments on commit 794b55b

Please sign in to comment.