2020-08-05 14:06:42 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-07-17 22:32:21 -07:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using Wox.Infrastructure.Logger;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Wox.Infrastructure.FileSystemHelper
|
|
|
|
|
|
{
|
|
|
|
|
|
public class FileWrapper : IFileWrapper
|
|
|
|
|
|
{
|
|
|
|
|
|
public FileWrapper() { }
|
|
|
|
|
|
|
|
|
|
|
|
public string[] ReadAllLines(string path)
|
|
|
|
|
|
{
|
2020-07-22 10:58:01 -07:00
|
|
|
|
try
|
2020-07-17 22:32:21 -07:00
|
|
|
|
{
|
2020-07-22 10:58:01 -07:00
|
|
|
|
return File.ReadAllLines(path);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (IOException ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Log.Info($"File {path} is being accessed by another process| {ex.Message}");
|
|
|
|
|
|
return new string[] { String.Empty };
|
2020-07-17 22:32:21 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|