@@ -283,32 +283,52 @@ static void WatchProgramUpdate()
283
283
284
284
public static async Task IndexWin32ProgramsAsync ( )
285
285
{
286
- var win32S = Win32 . All ( _settings ) ;
287
286
await _win32sLock . WaitAsync ( ) ;
288
- _win32s . Clear ( ) ;
289
- foreach ( var win32 in win32S )
287
+ try
290
288
{
291
- _win32s . Add ( win32 ) ;
289
+ var win32S = Win32 . All ( _settings ) ;
290
+ _win32s . Clear ( ) ;
291
+ foreach ( var win32 in win32S )
292
+ {
293
+ _win32s . Add ( win32 ) ;
294
+ }
295
+ ResetCache ( ) ;
296
+ await Context . API . SaveCacheBinaryStorageAsync < List < Win32 > > ( Win32CacheName , Context . CurrentPluginMetadata . PluginCacheDirectoryPath ) ;
297
+ _settings . LastIndexTime = DateTime . Now ;
298
+ }
299
+ catch ( Exception e )
300
+ {
301
+ Log . Exception ( "|Flow.Launcher.Plugin.Program.Main|Failed to index Win32 programs" , e ) ;
302
+ }
303
+ finally
304
+ {
305
+ _win32sLock . Release ( ) ;
292
306
}
293
- ResetCache ( ) ;
294
- await Context . API . SaveCacheBinaryStorageAsync < List < Win32 > > ( Win32CacheName , Context . CurrentPluginMetadata . PluginCacheDirectoryPath ) ;
295
- _settings . LastIndexTime = DateTime . Now ;
296
- _win32sLock . Release ( ) ;
297
307
}
298
308
299
309
public static async Task IndexUwpProgramsAsync ( )
300
310
{
301
- var uwps = UWPPackage . All ( _settings ) ;
302
311
await _uwpsLock . WaitAsync ( ) ;
303
- _uwps . Clear ( ) ;
304
- foreach ( var uwp in uwps )
312
+ try
305
313
{
306
- _uwps . Add ( uwp ) ;
314
+ var uwps = UWPPackage . All ( _settings ) ;
315
+ _uwps . Clear ( ) ;
316
+ foreach ( var uwp in uwps )
317
+ {
318
+ _uwps . Add ( uwp ) ;
319
+ }
320
+ ResetCache ( ) ;
321
+ await Context . API . SaveCacheBinaryStorageAsync < List < UWPApp > > ( UwpCacheName , Context . CurrentPluginMetadata . PluginCacheDirectoryPath ) ;
322
+ _settings . LastIndexTime = DateTime . Now ;
323
+ }
324
+ catch ( Exception e )
325
+ {
326
+ Log . Exception ( "|Flow.Launcher.Plugin.Program.Main|Failed to index Uwp programs" , e ) ;
327
+ }
328
+ finally
329
+ {
330
+ _uwpsLock . Release ( ) ;
307
331
}
308
- ResetCache ( ) ;
309
- await Context . API . SaveCacheBinaryStorageAsync < List < UWPApp > > ( UwpCacheName , Context . CurrentPluginMetadata . PluginCacheDirectoryPath ) ;
310
- _settings . LastIndexTime = DateTime . Now ;
311
- _uwpsLock . Release ( ) ;
312
332
}
313
333
314
334
public static async Task IndexProgramsAsync ( )
0 commit comments