mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
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:
@@ -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 };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user