mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-08 09:13:36 +00:00
Merge pull request #755 from KingLuigi4932/patch-3
Fixing WriteAllLines issue
This commit is contained in:
commit
cf08368c9e
2 changed files with 17 additions and 24 deletions
|
|
@ -618,19 +618,17 @@ namespace Cosmos.Kernel.Tests.Fat
|
||||||
mDebugger.Send("");
|
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);
|
||||||
//string[] contents = { "One", "Two", "Three" };
|
mDebugger.Send("Text written");
|
||||||
//File.WriteAllLines(@"0:\test3.txt", contents);
|
mDebugger.Send("Now reading with ReadAllLines()");
|
||||||
//mDebugger.Send("Text written");
|
string[] readLines = File.ReadAllLines(@"0:\test3.txt");
|
||||||
//mDebugger.Send("Now reading with ReadAllLines()");
|
mDebugger.Send("Contents retrieved after writing");
|
||||||
//string[] readLines = File.ReadAllLines(@"0:\test3.txt");
|
for (int i = 0; i < readLines.Length; i++)
|
||||||
//mDebugger.Send("Contents retrieved after writing");
|
{
|
||||||
//for (int i = 0; i < readLines.Length; i++)
|
mDebugger.Send(readLines[i]);
|
||||||
//{
|
}
|
||||||
// mDebugger.Send(readLines[i]);
|
Assert.IsTrue(StringArrayAreEquals(contents, readLines), "Contents of test3.txt was written incorrectly!");
|
||||||
//}
|
|
||||||
//Assert.IsTrue(StringArrayAreEquals(contents, readLines), "Contents of test3.txt was written incorrectly!");
|
|
||||||
#if false
|
#if false
|
||||||
// TODO maybe the more correct test is to implement ReadAllLines and then check that two arrays are equals
|
// 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");
|
var xContents = File.ReadAllText(@"0:\test3.txt");
|
||||||
|
|
|
||||||
|
|
@ -120,14 +120,9 @@ namespace Cosmos.System_Plugs.System.IO
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteAllLines(string aFile, IEnumerable<string> contents)
|
public static void WriteAllLines(string aFile, string[] contents)
|
||||||
{
|
{
|
||||||
string text = null;
|
string text = String.Join(Environment.NewLine, contents);
|
||||||
|
|
||||||
foreach (var line in contents)
|
|
||||||
{
|
|
||||||
text = string.Concat(text, line, Environment.NewLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("Writing contents");
|
Global.mFileSystemDebugger.SendInternal("Writing contents");
|
||||||
Global.mFileSystemDebugger.SendInternal(text);
|
Global.mFileSystemDebugger.SendInternal(text);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue