Fix for internet shortcut app not showing up on installation (#5131)

* added changed for internet shortcut app

* Added AppChanged event for url files

* Tests added

* refactoring
This commit is contained in:
Alekhya
2020-07-22 10:58:01 -07:00
committed by GitHub
parent f7ad935dfb
commit b59ec5e78b
4 changed files with 82 additions and 29 deletions

View File

@@ -13,29 +13,15 @@ namespace Wox.Infrastructure.FileSystemHelper
public string[] ReadAllLines(string path)
{
int attempt = 0;
int maxRetries = 5;
// Sometimes when files are being installed, url applications are written to line by line.
// During this process their contents cannot be read as they are being accessed by an other process.
// This ensures that if we do face this scenario, we retry after some time.
while(attempt < maxRetries)
try
{
try
{
return File.ReadAllLines(path);
}
catch (IOException ex)
{
attempt++;
Thread.Sleep(500);
Log.Info($"File {path} is being accessed by another process| {ex.Message}");
}
return File.ReadAllLines(path);
}
catch (IOException ex)
{
Log.Info($"File {path} is being accessed by another process| {ex.Message}");
return new string[] { String.Empty };
}
return new string[] { String.Empty };
}
}
}

View File

@@ -8,6 +8,7 @@ namespace Wox.Infrastructure.Storage
// Events to watch out for
event FileSystemEventHandler Created;
event FileSystemEventHandler Deleted;
event FileSystemEventHandler Changed;
event RenamedEventHandler Renamed;
// Properties of File System watcher