@@ -476,9 +476,9 @@ public override int GetHashCode()
476476 hash = hash * 23 + _isInitialized . GetHashCode ( ) ;
477477 hash = hash * 23 + _isRelative . GetHashCode ( ) ;
478478 foreach ( var element in _elements )
479- hash = hash * 23 + ( IsLinux ? element : element . ToUpperInvariant ( ) ) . GetHashCode ( ) ;
479+ hash = hash * 23 + ( IsUnix ? element : element . ToUpperInvariant ( ) ) . GetHashCode ( ) ;
480480 if ( _driveLetter != null )
481- hash = hash * 23 + ( IsLinux ? _driveLetter : _driveLetter . ToUpperInvariant ( ) ) . GetHashCode ( ) ;
481+ hash = hash * 23 + ( IsUnix ? _driveLetter : _driveLetter . ToUpperInvariant ( ) ) . GetHashCode ( ) ;
482482 return hash ;
483483 }
484484 }
@@ -1087,14 +1087,14 @@ public static IFileSystem FileSystem
10871087 }
10881088 }
10891089
1090- private static bool ? _isLinux ;
1091- internal static bool IsLinux
1090+ private static bool ? _isUnix ;
1091+ internal static bool IsUnix
10921092 {
10931093 get
10941094 {
1095- if ( ! _isLinux . HasValue )
1096- _isLinux = FileSystem . DirectoryExists ( "/proc" ) ;
1097- return _isLinux . Value ;
1095+ if ( ! _isUnix . HasValue )
1096+ _isUnix = Environment . OSVersion . Platform == PlatformID . MacOSX || Environment . OSVersion . Platform == PlatformID . Unix ;
1097+ return _isUnix . Value ;
10981098 }
10991099 }
11001100
@@ -1103,10 +1103,10 @@ private static StringComparison PathStringComparison
11031103 {
11041104 get
11051105 {
1106- // this is lazily evaluated because IsLinux uses the FileSystem object and that can be set
1106+ // this is lazily evaluated because IsUnix uses the FileSystem object and that can be set
11071107 // after static constructors happen here
11081108 if ( ! _pathStringComparison . HasValue )
1109- _pathStringComparison = IsLinux ? StringComparison . Ordinal : StringComparison . OrdinalIgnoreCase ;
1109+ _pathStringComparison = IsUnix ? StringComparison . Ordinal : StringComparison . OrdinalIgnoreCase ;
11101110 return _pathStringComparison . Value ;
11111111 }
11121112 }
@@ -1165,7 +1165,7 @@ public static NPath Resolve(this NPath path)
11651165 {
11661166 // Add a reference to Mono.Posix with an .rsp file in the Assets folder with the line "-r:Mono.Posix.dll" for this to work
11671167#if ENABLE_MONO
1168- if ( ! path . IsInitialized || ! NPath . IsLinux /* nothing to resolve on windows */ || path . IsRelative || ! path . FileExists ( ) )
1168+ if ( ! path . IsInitialized || ! NPath . IsUnix /* nothing to resolve on windows */ || path . IsRelative || ! path . FileExists ( ) )
11691169 return path ;
11701170 return new NPath ( Mono . Unix . UnixPath . GetCompleteRealPath ( path . ToString ( ) ) ) ;
11711171#else
0 commit comments