mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Make sure temporary files deleted
This commit is contained in:
parent
62a5dd784d
commit
150ea84191
1 changed files with 24 additions and 22 deletions
|
|
@ -41,6 +41,8 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
|||
if (string.IsNullOrEmpty(placesPath) || !File.Exists(placesPath))
|
||||
return bookmarks;
|
||||
|
||||
var tempDbPath = Path.Combine(_faviconCacheDir, $"tempplaces_{Guid.NewGuid()}.sqlite");
|
||||
|
||||
try
|
||||
{
|
||||
// Try to register file monitoring
|
||||
|
|
@ -54,7 +56,6 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
|||
}
|
||||
|
||||
// Use a copy to avoid lock issues with the original file
|
||||
var tempDbPath = Path.Combine(_faviconCacheDir, $"tempplaces_{Guid.NewGuid()}.sqlite");
|
||||
File.Copy(placesPath, tempDbPath, true);
|
||||
|
||||
// Connect to database and execute query
|
||||
|
|
@ -83,31 +84,32 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
|||
// https://github.com/dotnet/efcore/issues/26580
|
||||
SqliteConnection.ClearPool(dbConnection);
|
||||
dbConnection.Close();
|
||||
|
||||
// Delete temporary file
|
||||
try
|
||||
{
|
||||
File.Delete(tempDbPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to load Firefox bookmarks: {placesPath}", ex);
|
||||
}
|
||||
|
||||
// Delete temporary file
|
||||
try
|
||||
{
|
||||
File.Delete(tempDbPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex);
|
||||
}
|
||||
|
||||
return bookmarks;
|
||||
}
|
||||
|
||||
private void LoadFaviconsFromDb(string faviconDbPath, List<Bookmark> bookmarks)
|
||||
{
|
||||
var tempDbPath = Path.Combine(_faviconCacheDir, $"tempfavicons_{Guid.NewGuid()}.sqlite");
|
||||
|
||||
try
|
||||
{
|
||||
// Use a copy to avoid lock issues with the original file
|
||||
var tempDbPath = Path.Combine(_faviconCacheDir, $"tempfavicons_{Guid.NewGuid()}.sqlite");
|
||||
File.Copy(faviconDbPath, tempDbPath, true);
|
||||
|
||||
var defaultIconPath = Path.Combine(
|
||||
|
|
@ -177,21 +179,21 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
|||
// https://github.com/dotnet/efcore/issues/26580
|
||||
SqliteConnection.ClearPool(connection);
|
||||
connection.Close();
|
||||
|
||||
// Delete temporary file
|
||||
try
|
||||
{
|
||||
File.Delete(tempDbPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to load Firefox favicon DB: {faviconDbPath}", ex);
|
||||
}
|
||||
|
||||
// Delete temporary file
|
||||
try
|
||||
{
|
||||
File.Delete(tempDbPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveBitmapData(byte[] imageData, string outputPath)
|
||||
|
|
|
|||
Loading…
Reference in a new issue