File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/libraries/Common/src/System/IO Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,28 @@ internal static StringComparison StringComparison
31
31
/// <summary>
32
32
/// Determines whether the file system is case sensitive.
33
33
/// </summary>
34
+ private static bool GetIsCaseSensitive ( )
35
+ {
36
+ // Return a constant for mobile platforms without resorting to I/O
37
+ if ( OperatingSystem . IsMacOS ( ) || OperatingSystem . IsMacCatalyst ( ) || OperatingSystem . IsIOS ( ) || OperatingSystem . IsTvOS ( ) || OperatingSystem . IsWatchOS ( ) )
38
+ return true ;
39
+ if ( OperatingSystem . IsBrowser ( ) )
40
+ return false ;
41
+ if ( OperatingSystem . IsAndroid ( ) )
42
+ return false ;
43
+ return GetIsCaseSensitiveByProbing ( ) ;
44
+ }
45
+
46
+ /// <summary>
47
+ /// Determines whether the file system is case sensitive by creating a file in a temp folder and observing the result.
48
+ /// </summary>
34
49
/// <remarks>
35
50
/// Ideally we'd use something like pathconf with _PC_CASE_SENSITIVE, but that is non-portable,
36
51
/// not supported on Windows or Linux, etc. For now, this function creates a tmp file with capital letters
37
52
/// and then tests for its existence with lower-case letters. This could return invalid results in corner
38
53
/// cases where, for example, different file systems are mounted with differing sensitivities.
39
54
/// </remarks>
40
- private static bool GetIsCaseSensitive ( )
55
+ private static bool GetIsCaseSensitiveByProbing ( )
41
56
{
42
57
try
43
58
{
You can’t perform that action at this time.
0 commit comments