mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Make sure the places.sqlite file exists
before loading Firefox bookmarks.
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Wox.Plugin.BrowserBookmark
|
||||
|
||||
public List<Bookmark> GetBookmarks(string search = null)
|
||||
{
|
||||
//TODO: Maybe load bookmarks here instead of pre-loading them at startup?
|
||||
if (string.IsNullOrEmpty(search)) return bookmarks;
|
||||
|
||||
var fuzzyMatcher = FuzzyMatcher.Create(search);
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace Wox.Plugin.BrowserBookmark
|
||||
/// </summary>
|
||||
private List<Bookmark> GetResults(string query)
|
||||
{
|
||||
// Return empty list if the places.sqlite file cannot be found
|
||||
if (string.IsNullOrEmpty(PlacesPath) || !File.Exists(PlacesPath))
|
||||
return new List<Bookmark>();
|
||||
|
||||
// create the connection string and init the connection
|
||||
string dbPath = string.Format(dbPathFormat, PlacesPath);
|
||||
var dbConnection = new SQLiteConnection(dbPath);
|
||||
@@ -66,6 +70,10 @@ namespace Wox.Plugin.BrowserBookmark
|
||||
get
|
||||
{
|
||||
var profilesPath = Environment.ExpandEnvironmentVariables(@"%appdata%\Mozilla\Firefox\Profiles\");
|
||||
|
||||
// return null if the Profiles folder does not exist
|
||||
if (!Directory.Exists(profilesPath)) return null;
|
||||
|
||||
var folders = new DirectoryInfo(profilesPath).GetDirectories().Select(x => x.FullName).ToList();
|
||||
|
||||
// Look for the default profile folder
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Wox.Plugin.BrowserBookmark
|
||||
|
||||
var returnList = new List<Bookmark>();
|
||||
|
||||
//TODO: Let the user select which browser's bookmarks are displayed
|
||||
// Add Firefox bookmarks
|
||||
returnList.AddRange(mozBookmarks.GetBookmarks(param, topResults));
|
||||
// Add Chrome bookmarks
|
||||
|
||||
Reference in New Issue
Block a user