Skip to content

Commit 06cc89b

Browse files
fix(desktop): resolve cookie database path through the FileSystem service
1 parent 5284330 commit 06cc89b

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

‎apps/desktop/src/preview/BrowserImport/BrowserImport.ts‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)