From 7e481aaee32f7e46a9dbc2d22dbd8d7224ede9f1 Mon Sep 17 00:00:00 2001 From: Matthijs ter Woord Date: Sat, 4 Jul 2015 15:53:04 +0200 Subject: [PATCH] Fix fat Directory.Exists, so it works with case insensitive match as well. --- Users/Sentinel/SentinelKernel/Kernel.cs | 4 ++-- Users/Sentinel/SentinelSystem/FileSystem/FatHelpers.cs | 2 +- Users/Sentinel/SentinelSystem/SentinelVFS.cs | 4 ++++ source/Cosmos.Core.Plugs/StringImpl.cs | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Users/Sentinel/SentinelKernel/Kernel.cs b/Users/Sentinel/SentinelKernel/Kernel.cs index f4569c8cb..6a44e4332 100644 --- a/Users/Sentinel/SentinelKernel/Kernel.cs +++ b/Users/Sentinel/SentinelKernel/Kernel.cs @@ -24,7 +24,7 @@ namespace SentinelKernel try { var xRoot = Path.GetPathRoot(@"0:\test"); - bool xTest = Directory.Exists("0:\\TEST"); + bool xTest = Directory.Exists("0:\\test"); Console.WriteLine("After test"); if (xTest) { @@ -41,7 +41,7 @@ namespace SentinelKernel Console.WriteLine("Exception occurred:"); Console.WriteLine(e.Message); } - + Stop(); } } diff --git a/Users/Sentinel/SentinelSystem/FileSystem/FatHelpers.cs b/Users/Sentinel/SentinelSystem/FileSystem/FatHelpers.cs index 043221718..5e197996b 100644 --- a/Users/Sentinel/SentinelSystem/FileSystem/FatHelpers.cs +++ b/Users/Sentinel/SentinelSystem/FileSystem/FatHelpers.cs @@ -8,7 +8,7 @@ namespace SentinelKernel.System.FileSystem private static Debugger mDebugger = new Debugger("FAT", "Debug"); public static void Debug(string message) { - //mDebugger.Send("FAT Debug: " + message); + mDebugger.Send("FAT Debug: " + message); } } } diff --git a/Users/Sentinel/SentinelSystem/SentinelVFS.cs b/Users/Sentinel/SentinelSystem/SentinelVFS.cs index 5e2fad0b6..a22598f0b 100644 --- a/Users/Sentinel/SentinelSystem/SentinelVFS.cs +++ b/Users/Sentinel/SentinelSystem/SentinelVFS.cs @@ -243,6 +243,10 @@ namespace SentinelKernel.System.FileSystem.VFS for (int j = 0; j < xListing.Count; j++) { var xListingItem = xListing[j]; + Console.Write("xListingItem.Name: "); + Console.WriteLine(xListingItem.Name); + Console.Write("xPathPart: "); + Console.WriteLine(xPathPart); if (String.Equals(xListingItem.Name, xPathPart, StringComparison.OrdinalIgnoreCase)) { if (xListingItem is Listing.Directory) diff --git a/source/Cosmos.Core.Plugs/StringImpl.cs b/source/Cosmos.Core.Plugs/StringImpl.cs index 7f6dbbd4e..c3a964694 100644 --- a/source/Cosmos.Core.Plugs/StringImpl.cs +++ b/source/Cosmos.Core.Plugs/StringImpl.cs @@ -144,6 +144,12 @@ namespace Cosmos.Core.Plugs { public static bool Equals(string aThis, string aThat, StringComparison aComparison) { #warning TODO: implement + if (aComparison == StringComparison.OrdinalIgnoreCase) + { + var xLowerThis = aThis.ToLower(); + var xLowerThat = aThat.ToLower(); + return EqualsHelper(xLowerThis, xLowerThat); + } return EqualsHelper(aThis, aThat); }