MCPcopy Create free account
hub / github.com/chhoumann/quickadd / linkHostKeychains

Function linkHostKeychains

scripts/start-obsidian-e2e-instance.mjs:255–280  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

253}
254
255async function linkHostKeychains(options) {
256 const realHome = process.env.HOME;
257 if (!realHome) return;
258
259 const source = path.join(realHome, "Library", "Keychains");
260 const destination = path.join(options.obsidianHome, "Library", "Keychains");
261 try {
262 await fs.lstat(source);
263 } catch (error) {
264 if (error?.code === "ENOENT") return;
265 throw error;
266 }
267
268 try {
269 const stat = await fs.lstat(destination);
270 if (!stat.isSymbolicLink()) return;
271 const target = await fs.readlink(destination);
272 if (path.resolve(path.dirname(destination), target) === source) return;
273 await fs.unlink(destination);
274 } catch (error) {
275 if (error?.code !== "ENOENT") throw error;
276 }
277
278 await fs.mkdir(path.dirname(destination), { recursive: true });
279 await fs.symlink(source, destination);
280}
281
282function stableVaultId(vaultPath) {
283 return crypto

Callers 1

prepareObsidianProfileFunction · 0.85

Calls 2

dirnameMethod · 0.80
resolveMethod · 0.45

Tested by

no test coverage detected