diff --git a/Tests/Cosmos.Kernel.Tests.Fat/Kernel.cs b/Tests/Cosmos.Kernel.Tests.Fat/Kernel.cs index 63be92cc8..0842ce508 100644 --- a/Tests/Cosmos.Kernel.Tests.Fat/Kernel.cs +++ b/Tests/Cosmos.Kernel.Tests.Fat/Kernel.cs @@ -617,20 +617,18 @@ namespace Cosmos.Kernel.Tests.Fat mDebugger.Send("END TEST"); mDebugger.Send(""); } - - // Generic methods on arrays don't work, see https://github.com/CosmosOS/Cosmos/issues/583 - // - //string[] contents = { "One", "Two", "Three" }; - //File.WriteAllLines(@"0:\test3.txt", contents); - //mDebugger.Send("Text written"); - //mDebugger.Send("Now reading with ReadAllLines()"); - //string[] readLines = File.ReadAllLines(@"0:\test3.txt"); - //mDebugger.Send("Contents retrieved after writing"); - //for (int i = 0; i < readLines.Length; i++) - //{ - // mDebugger.Send(readLines[i]); - //} - //Assert.IsTrue(StringArrayAreEquals(contents, readLines), "Contents of test3.txt was written incorrectly!"); + + string[] contents = { "One", "Two", "Three" }; + File.WriteAllLines(@"0:\test3.txt", contents); + mDebugger.Send("Text written"); + mDebugger.Send("Now reading with ReadAllLines()"); + string[] readLines = File.ReadAllLines(@"0:\test3.txt"); + mDebugger.Send("Contents retrieved after writing"); + for (int i = 0; i < readLines.Length; i++) + { + mDebugger.Send(readLines[i]); + } + Assert.IsTrue(StringArrayAreEquals(contents, readLines), "Contents of test3.txt was written incorrectly!"); #if false // TODO maybe the more correct test is to implement ReadAllLines and then check that two arrays are equals var xContents = File.ReadAllText(@"0:\test3.txt"); diff --git a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs index 86c048bc9..26f8ab1b0 100644 --- a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs +++ b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs @@ -119,19 +119,14 @@ namespace Cosmos.System_Plugs.System.IO return result; } - - public static void WriteAllLines(string aFile, IEnumerable contents) + + public static void WriteAllLines(string aFile, string[] contents) { - string text = null; - - foreach (var line in contents) - { - text = string.Concat(text, line, Environment.NewLine); - } - + string text = String.Join(Environment.NewLine, contents); + Global.mFileSystemDebugger.SendInternal("Writing contents"); Global.mFileSystemDebugger.SendInternal(text); - + WriteAllText(aFile, text); }