Skip to content

Commit f59e239

Browse files
committed
Add error handling for directory operation
1 parent 57470a9 commit f59e239

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,22 @@ public static string MsixPlacesPath
294294
{
295295
var platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
296296
var packagesPath = Path.Combine(platformPath, "Packages");
297-
298-
// Search for folder with Mozilla.Firefox prefix
299-
var firefoxPackageFolder = Directory.EnumerateDirectories(packagesPath, "Mozilla.Firefox*",
300-
SearchOption.TopDirectoryOnly).FirstOrDefault();
297+
try
298+
{
299+
// Search for folder with Mozilla.Firefox prefix
300+
var firefoxPackageFolder = Directory.EnumerateDirectories(packagesPath, "Mozilla.Firefox*",
301+
SearchOption.TopDirectoryOnly).FirstOrDefault();
301302

302-
// Msix FireFox not installed
303-
if (firefoxPackageFolder == null) return string.Empty;
303+
// Msix FireFox not installed
304+
if (firefoxPackageFolder == null) return string.Empty;
304305

305-
var profileFolderPath = Path.Combine(firefoxPackageFolder, @"LocalCache\Roaming\Mozilla\Firefox");
306-
return GetProfileIniPath(profileFolderPath);
306+
var profileFolderPath = Path.Combine(firefoxPackageFolder, @"LocalCache\Roaming\Mozilla\Firefox");
307+
return GetProfileIniPath(profileFolderPath);
308+
}
309+
catch
310+
{
311+
return string.Empty;
312+
}
307313
}
308314
}
309315

0 commit comments

Comments
 (0)