2 Bug Fixes (#112)
Add a try-catch in ReadAllLines to handle a read failure if a file is locked. Add a check for a non-existing export folder when exporting and prompt for new path if it doesn't exist.
This commit is contained in:
parent
5bbf2f50de
commit
639ad72fb4
2 changed files with 11 additions and 4 deletions
|
|
@ -420,13 +420,20 @@ namespace Observatory
|
|||
private List<string> ReadAllLines(string path)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
using (StreamReader file = new StreamReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
try
|
||||
{
|
||||
while (!file.EndOfStream)
|
||||
using (StreamReader file = new StreamReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||
{
|
||||
lines.Add(file.ReadLine());
|
||||
while (!file.EndOfStream)
|
||||
{
|
||||
lines.Add(file.ReadLine());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ioEx)
|
||||
{
|
||||
ReportErrors(new List<(Exception, string, string)>() { (ioEx, path, "<reading all lines>") });
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue