@@ -41,6 +41,8 @@ protected List<Bookmark> GetBookmarksFromPath(string placesPath)
41
41
if ( string . IsNullOrEmpty ( placesPath ) || ! File . Exists ( placesPath ) )
42
42
return bookmarks ;
43
43
44
+ var tempDbPath = Path . Combine ( _faviconCacheDir , $ "tempplaces_{ Guid . NewGuid ( ) } .sqlite") ;
45
+
44
46
try
45
47
{
46
48
// Try to register file monitoring
@@ -54,7 +56,6 @@ protected List<Bookmark> GetBookmarksFromPath(string placesPath)
54
56
}
55
57
56
58
// Use a copy to avoid lock issues with the original file
57
- var tempDbPath = Path . Combine ( _faviconCacheDir , $ "tempplaces_{ Guid . NewGuid ( ) } .sqlite") ;
58
59
File . Copy ( placesPath , tempDbPath , true ) ;
59
60
60
61
// Connect to database and execute query
@@ -83,31 +84,32 @@ protected List<Bookmark> GetBookmarksFromPath(string placesPath)
83
84
// https://github.com/dotnet/efcore/issues/26580
84
85
SqliteConnection . ClearPool ( dbConnection ) ;
85
86
dbConnection . Close ( ) ;
86
-
87
- // Delete temporary file
88
- try
89
- {
90
- File . Delete ( tempDbPath ) ;
91
- }
92
- catch ( Exception ex )
93
- {
94
- Main . _context . API . LogException ( ClassName , $ "Failed to delete temporary favicon DB: { tempDbPath } ", ex ) ;
95
- }
96
87
}
97
88
catch ( Exception ex )
98
89
{
99
90
Main . _context . API . LogException ( ClassName , $ "Failed to load Firefox bookmarks: { placesPath } ", ex ) ;
100
91
}
101
92
93
+ // Delete temporary file
94
+ try
95
+ {
96
+ File . Delete ( tempDbPath ) ;
97
+ }
98
+ catch ( Exception ex )
99
+ {
100
+ Main . _context . API . LogException ( ClassName , $ "Failed to delete temporary favicon DB: { tempDbPath } ", ex ) ;
101
+ }
102
+
102
103
return bookmarks ;
103
104
}
104
105
105
106
private void LoadFaviconsFromDb ( string faviconDbPath , List < Bookmark > bookmarks )
106
107
{
108
+ var tempDbPath = Path . Combine ( _faviconCacheDir , $ "tempfavicons_{ Guid . NewGuid ( ) } .sqlite") ;
109
+
107
110
try
108
111
{
109
112
// Use a copy to avoid lock issues with the original file
110
- var tempDbPath = Path . Combine ( _faviconCacheDir , $ "tempfavicons_{ Guid . NewGuid ( ) } .sqlite") ;
111
113
File . Copy ( faviconDbPath , tempDbPath , true ) ;
112
114
113
115
var defaultIconPath = Path . Combine (
@@ -177,21 +179,21 @@ ORDER BY i.width DESC -- Select largest icon available
177
179
// https://github.com/dotnet/efcore/issues/26580
178
180
SqliteConnection . ClearPool ( connection ) ;
179
181
connection . Close ( ) ;
180
-
181
- // Delete temporary file
182
- try
183
- {
184
- File . Delete ( tempDbPath ) ;
185
- }
186
- catch ( Exception ex )
187
- {
188
- Main . _context . API . LogException ( ClassName , $ "Failed to delete temporary favicon DB: { tempDbPath } ", ex ) ;
189
- }
190
182
}
191
183
catch ( Exception ex )
192
184
{
193
185
Main . _context . API . LogException ( ClassName , $ "Failed to load Firefox favicon DB: { faviconDbPath } ", ex ) ;
194
186
}
187
+
188
+ // Delete temporary file
189
+ try
190
+ {
191
+ File . Delete ( tempDbPath ) ;
192
+ }
193
+ catch ( Exception ex )
194
+ {
195
+ Main . _context . API . LogException ( ClassName , $ "Failed to delete temporary favicon DB: { tempDbPath } ", ex ) ;
196
+ }
195
197
}
196
198
197
199
private static void SaveBitmapData ( byte [ ] imageData , string outputPath )
0 commit comments