Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Version.Details.props" />

<PropertyGroup>
<VersionPrefix>18.5.0</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind><!-- Keep next to VersionPrefix to create a conflict in forward-flow -->
<VersionPrefix>18.5.1</VersionPrefix><DotNetFinalVersionKind>release</DotNetFinalVersionKind><!-- Keep next to VersionPrefix to create a conflict in forward-flow -->
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<PackageValidationBaselineVersion>18.0.2</PackageValidationBaselineVersion>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
Expand Down Expand Up @@ -102,4 +102,3 @@
</Target>

</Project>

21 changes: 0 additions & 21 deletions src/Framework/PathHelpers/AbsolutePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,6 @@ internal AbsolutePath GetCanonicalForm()
return this;
}


// Note: this is a quick check to avoid calling Path.GetFullPath when it's not necessary, since it can be expensive.
// It should cover the most common cases and avoid the overhead of Path.GetFullPath in those cases.

// Check for relative path segments "." and ".."
// In absolute path those segments can not appear in the beginning of the path, only after a path separator.
// This is not a precise full detection of relative segments. There is no false negatives as this might affect correctenes, but it may have false positives:
// like when there is a hidden file or directory starting with a dot, or on linux the backslash and dot can be part of the file name.
// In case of false positives we would call Path.GetFullPath and the result would still be correct.

bool hasRelativeSegment = Value.Contains("/.") || Value.Contains("\\.");

// Check if directory separator normalization is required (only on Windows: "/" to "\")
// On unix "\" is not a valid path separator, but is a part of the file/directory name, so no normalization is needed.
bool needsSeparatorNormalization = NativeMethods.IsWindows && Value.IndexOf(Path.AltDirectorySeparatorChar) >= 0;

if (!hasRelativeSegment && !needsSeparatorNormalization)
{
return this;
}

// Use Path.GetFullPath to resolve relative segments and normalize separators.
// Skip validation since Path.GetFullPath already ensures the result is absolute.
return new AbsolutePath(Path.GetFullPath(Value), OriginalValue, ignoreRootedCheck: true);
Comment thread
AR-May marked this conversation as resolved.
Expand Down
Loading