diff --git a/src/RhinoInside.Revit.External/Extensions/System.cs b/src/RhinoInside.Revit.External/Extensions/System.cs index ad6c76130..39d2ca142 100644 --- a/src/RhinoInside.Revit.External/Extensions/System.cs +++ b/src/RhinoInside.Revit.External/Extensions/System.cs @@ -250,20 +250,24 @@ static class PathExtension public static bool IsFullyQualifiedPath(this string path) { if (path == null) return false; + +#if NET5_0_OR_GREATER + return Path.IsPathFullyQualified(path); +#else if (path.Length < 2) return false; - if (IsDirectorySeparator(path[0])) - return path[1] == '?' || IsDirectorySeparator(path[1]); - return - ( - (path.Length >= 3) && - (path[1] == Path.VolumeSeparatorChar) && - IsDirectorySeparator(path[2]) && - IsValidDriveChar(path[0]) - ); + return IsDirectorySeparator(path[0]) ? + IsDirectorySeparator(path[1]) : + ( + path.Length >= 3 && + path[1] == Path.VolumeSeparatorChar && + IsDirectorySeparator(path[2]) && + IsValidDriveChar(path[0]) + ); bool IsValidDriveChar(char value) => ('A' <= value && value <= 'Z') || ('a' <= value && value <= 'z'); bool IsDirectorySeparator(char c) => c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar; +#endif } [DllImport("SHLWAPI", CharSet = CharSet.Unicode)]