Skip to content

Commit

Permalink
Move unused code in correct #if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Dec 16, 2024
1 parent 77ff0ad commit ac9e237
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ protected override bool IsDirectorySeparator(char c)
protected override bool IsEffectivelyEmpty(string path)
=> string.IsNullOrEmpty(path);

#if FEATURE_PATH_RELATIVE
/// <summary>
/// https://github.com/dotnet/runtime/blob/v8.0.4/src/libraries/Common/src/System/IO/PathInternal.Unix.cs#L77
/// </summary>
protected override bool IsPartiallyQualified(string path)
=> !IsPathRooted(path);
#endif

/// <summary>
/// https://github.com/dotnet/runtime/blob/v8.0.4/src/libraries/Common/src/System/IO/PathInternal.Unix.cs#L39
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ string NormalizePath(string path)
return sb.ToString();
}

#if FEATURE_PATH_RELATIVE
/// <summary>
/// We have the same root, we need to calculate the difference now using the
/// common Length and Segment count past the length.
Expand Down Expand Up @@ -606,7 +607,9 @@ private string CreateRelativePath(string relativeTo, string path, int commonLeng

return sb.ToString();
}
#endif

#if FEATURE_PATH_RELATIVE
/// <summary>
/// Get the common path length from the start of the string.
/// </summary>
Expand Down Expand Up @@ -653,12 +656,15 @@ private int GetCommonPathLength(string first, string second,

return commonChars;
}
#endif

protected abstract int GetRootLength(string path);
protected abstract bool IsDirectorySeparator(char c);
protected abstract bool IsEffectivelyEmpty(string path);

#if FEATURE_PATH_RELATIVE
protected abstract bool IsPartiallyQualified(string path);
#endif

#if FEATURE_PATH_JOIN || FEATURE_PATH_ADVANCED
private string JoinInternal(string?[] paths)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ protected override bool IsEffectivelyEmpty(string path)
return path.All(c => c == ' ');
}

#if FEATURE_PATH_RELATIVE
/// <summary>
/// https://github.com/dotnet/runtime/blob/v8.0.4/src/libraries/Common/src/System/IO/PathInternal.Windows.cs#L250
/// </summary>
Expand Down Expand Up @@ -279,6 +280,7 @@ protected override bool IsPartiallyQualified(string path)
// not qualified if you don't have a valid drive. "=:\" is the "=" file's default data stream.
&& IsValidDriveChar(path[0]));
}
#endif

/// <summary>
/// Returns true if the given character is a valid drive letter
Expand Down

0 comments on commit ac9e237

Please sign in to comment.