File tree Expand file tree Collapse file tree
apps/desktop/src/preview/BrowserImport Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,19 +171,13 @@ export const make = Effect.gen(function* BrowserImportMake() {
171171 ) ;
172172 // Try each candidate path and use the first one that exists. Chromium 96+
173173 // moved the cookie database into `Network/Cookies`, so both locations are
174- // checked. The stat is synchronous because it is a fast local-FS probe and
175- // avoids needing to pick an Effect pipe combinator that varies across
176- // beta releases.
177- const nodeFs = require ( "node:fs" ) as typeof import ( "node:fs" ) ;
178- const databasePath = ( ( ) => {
179- for ( const candidate of candidates ) {
180- try {
181- nodeFs . statSync ( candidate ) ;
182- return candidate ;
183- } catch { }
184- }
185- return undefined ;
186- } ) ( ) ;
174+ // checked. The FileSystem service comes from the captured platformServices
175+ // context so this method keeps its empty requirements channel.
176+ const fileSystem = Context . get ( platformServices , FileSystem . FileSystem ) ;
177+ const existing = yield * Effect . forEach ( candidates , ( candidate ) =>
178+ fileSystem . exists ( candidate ) . pipe ( Effect . orElseSucceed ( ( ) => false ) ) ,
179+ ) ;
180+ const databasePath = candidates . find ( ( _ , index ) => existing [ index ] ) ;
187181 if ( databasePath === undefined ) {
188182 // A profile we listed moments ago can lose its database before the
189183 // import runs (browser data cleanup, a profile reset). That is a read
You can’t perform that action at this time.
0 commit comments