Skip to content

Commit bc5f9bf

Browse files
committed
updated CI 14
1 parent 6681194 commit bc5f9bf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.azdevops/TestsTemplate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ jobs:
8484
$content = 7z.exe a archive.zip .azdevops
8585
$content | Write-Verbose -Verbose
8686
}
87-
Get-ChildItem $(PowerShellPreviewExecutablePath) | Write-Verbose
8887
"$(PowerShellPreviewExecutablePath) .azdevops/RunTests.ps1" | Invoke-Expression
8988
if ("${{ parameters.vmImageName }}" -like 'macos-*')
9089
{
9190
"pwsh .azdevops/RunTests.ps1" | Invoke-Expression
91+
"pwsh-preview .azdevops/RunTests.ps1" | Invoke-Expression
9292
}
9393
displayName: Run Tests
9494

src/PathHelper.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ private string GetEntryName(FileSystemInfo fileSystemInfo, out bool doesPreserve
126126
Debug.Assert(relativePath is not null);
127127
doesPreservePathStructure = true;
128128
entryName = relativePath;
129+
130+
_cmdlet.WriteVerbose($"Relative path, entry name: {entryName}");
129131
}
130132
// Otherwise, return the name of the directory or file
131133
else
@@ -137,6 +139,8 @@ private string GetEntryName(FileSystemInfo fileSystemInfo, out bool doesPreserve
137139
{
138140
entryName += System.IO.Path.DirectorySeparatorChar;
139141
}
142+
143+
140144
return entryName;
141145
}
142146

@@ -198,7 +202,14 @@ private static string GetPrefixForPath(System.IO.DirectoryInfo directoryInfo)
198202
/// <returns></returns>
199203
private bool TryGetPathRelativeToCurrentWorkingDirectory(string path, out string? relativePathToWorkingDirectory)
200204
{
201-
string relativePath = System.IO.Path.GetRelativePath(_cmdlet.SessionState.Path.CurrentFileSystemLocation.Path, path);
205+
Debug.Assert(!string.IsNullOrEmpty(path));
206+
string? workingDirectoryRoot = Path.GetPathRoot(_cmdlet.SessionState.Path.CurrentFileSystemLocation.Path);
207+
string? pathRoot = Path.GetPathRoot(path);
208+
if (workingDirectoryRoot != pathRoot) {
209+
relativePathToWorkingDirectory = null;
210+
return false;
211+
}
212+
string relativePath = Path.GetRelativePath(_cmdlet.SessionState.Path.CurrentFileSystemLocation.Path, path);
202213
relativePathToWorkingDirectory = relativePath.Contains("..") ? null : relativePath;
203214
return relativePathToWorkingDirectory is not null;
204215
}

0 commit comments

Comments
 (0)