mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Make sure the places.sqlite file exists
before loading Firefox bookmarks.
This commit is contained in:
parent
6807dcbd5d
commit
73530f59de
3 changed files with 10 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ namespace Wox.Plugin.BrowserBookmark
|
||||||
|
|
||||||
public List<Bookmark> GetBookmarks(string search = null)
|
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;
|
if (string.IsNullOrEmpty(search)) return bookmarks;
|
||||||
|
|
||||||
var fuzzyMatcher = FuzzyMatcher.Create(search);
|
var fuzzyMatcher = FuzzyMatcher.Create(search);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@ namespace Wox.Plugin.BrowserBookmark
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<Bookmark> GetResults(string query)
|
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
|
// create the connection string and init the connection
|
||||||
string dbPath = string.Format(dbPathFormat, PlacesPath);
|
string dbPath = string.Format(dbPathFormat, PlacesPath);
|
||||||
var dbConnection = new SQLiteConnection(dbPath);
|
var dbConnection = new SQLiteConnection(dbPath);
|
||||||
|
|
@ -66,6 +70,10 @@ namespace Wox.Plugin.BrowserBookmark
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var profilesPath = Environment.ExpandEnvironmentVariables(@"%appdata%\Mozilla\Firefox\Profiles\");
|
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();
|
var folders = new DirectoryInfo(profilesPath).GetDirectories().Select(x => x.FullName).ToList();
|
||||||
|
|
||||||
// Look for the default profile folder
|
// Look for the default profile folder
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ namespace Wox.Plugin.BrowserBookmark
|
||||||
|
|
||||||
var returnList = new List<Bookmark>();
|
var returnList = new List<Bookmark>();
|
||||||
|
|
||||||
|
//TODO: Let the user select which browser's bookmarks are displayed
|
||||||
// Add Firefox bookmarks
|
// Add Firefox bookmarks
|
||||||
returnList.AddRange(mozBookmarks.GetBookmarks(param, topResults));
|
returnList.AddRange(mozBookmarks.GetBookmarks(param, topResults));
|
||||||
// Add Chrome bookmarks
|
// Add Chrome bookmarks
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue