obsidian-launcher 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -360,12 +360,14 @@ var ChromeLocalStorage = class {
360
360
  import fsAsync3 from "fs/promises";
361
361
  import fs3 from "fs";
362
362
  import path4 from "path";
363
+ import { promisify } from "util";
363
364
  import child_process from "child_process";
364
365
  import semver from "semver";
365
366
  import _3 from "lodash";
366
367
  import { pipeline } from "stream/promises";
367
368
  import zlib from "zlib";
368
369
  import { fileURLToPath } from "url";
370
+ var execFile = promisify(child_process.execFile);
369
371
  function normalizeGitHubRepo(repo) {
370
372
  return repo.match(/^(https?:\/\/)?(github.com\/)?(.*?)\/?$/)?.[3] ?? repo;
371
373
  }
@@ -424,12 +426,23 @@ async function extractObsidianExe(exe, arch, dest) {
424
426
  async function extractObsidianDmg(dmg, dest) {
425
427
  dest = path4.resolve(dest);
426
428
  await atomicCreate(dest, async (scratch) => {
427
- await sevenZ(["x", "-o.", path4.relative(scratch, dmg), "*/Obsidian.app", "Obsidian.app"], { cwd: scratch });
428
- const files = await fsAsync3.readdir(scratch);
429
- if (files.includes("Obsidian.app")) {
430
- return "Obsidian.app";
429
+ if (process.platform == "darwin") {
430
+ const proc = await execFile("hdiutil", ["attach", "-nobrowse", "-readonly", dmg]);
431
+ const volume = proc.stdout.match(/\/Volumes\/.*$/m)[0];
432
+ const files = await fsAsync3.readdir(volume);
433
+ let obsidianApp = files.includes("Obsidian.app") ? "Obsidian.app" : path4.join(files[0], "Obsidian.app");
434
+ obsidianApp = path4.join(volume, obsidianApp);
435
+ try {
436
+ await fsAsync3.cp(obsidianApp, scratch, { recursive: true, verbatimSymlinks: true, preserveTimestamps: true });
437
+ } finally {
438
+ await execFile("hdiutil", ["detach", volume]);
439
+ }
440
+ return scratch;
431
441
  } else {
432
- return path4.join(files[0], "Obsidian.app");
442
+ await sevenZ(["x", "-o.", path4.relative(scratch, dmg), "*/Obsidian.app", "Obsidian.app"], { cwd: scratch });
443
+ const files = await fsAsync3.readdir(scratch);
444
+ const obsidianApp = files.includes("Obsidian.app") ? "Obsidian.app" : path4.join(files[0], "Obsidian.app");
445
+ return path4.join(scratch, obsidianApp);
433
446
  }
434
447
  });
435
448
  }
@@ -1583,4 +1596,4 @@ export {
1583
1596
  watchFiles,
1584
1597
  ObsidianLauncher
1585
1598
  };
1586
- //# sourceMappingURL=chunk-AUVMYPHG.js.map
1599
+ //# sourceMappingURL=chunk-RFPT36TQ.js.map