cicy-desktop 2.1.37 → 2.1.38
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.
- package/bin/cicy-desktop +8 -0
- package/package.json +1 -1
package/bin/cicy-desktop
CHANGED
|
@@ -377,6 +377,12 @@ function ensureMacDesktopApp() {
|
|
|
377
377
|
// via `do shell script`, then quits. Icon = the applet's applet.icns.
|
|
378
378
|
const { execFileSync } = require("child_process");
|
|
379
379
|
const appDir = path.join(DESKTOP_DIR, "CiCy Desktop.app");
|
|
380
|
+
// Idempotent — create only when missing. When the app is launched FROM this
|
|
381
|
+
// very applet (double-click), the old code's fs.rmSync(appDir) tries to
|
|
382
|
+
// delete the running bundle: the rmdir syscall blocks FOREVER (the app
|
|
383
|
+
// deleting itself), so startup hangs at "Cleaning up ports" and no window
|
|
384
|
+
// ever appears ("打不开"). Skip if it already exists.
|
|
385
|
+
if (fs.existsSync(appDir)) return;
|
|
380
386
|
const nodeDir = nodeBinDir();
|
|
381
387
|
// do shell script needs node on PATH (GUI launch has a minimal PATH); the
|
|
382
388
|
// trailing & + nohup + </dev/null lets the shell return so the applet quits.
|
|
@@ -407,6 +413,7 @@ function ensureMacDesktopApp() {
|
|
|
407
413
|
function ensureLinuxDesktopEntry() {
|
|
408
414
|
const icon = path.join(PACKAGE_ROOT, "build", "icons", "icon-256.png");
|
|
409
415
|
const file = path.join(DESKTOP_DIR, "cicy-desktop.desktop");
|
|
416
|
+
if (fs.existsSync(file)) return; // idempotent: create only when missing
|
|
410
417
|
fs.mkdirSync(DESKTOP_DIR, { recursive: true });
|
|
411
418
|
fs.writeFileSync(file,
|
|
412
419
|
`[Desktop Entry]
|
|
@@ -433,6 +440,7 @@ function ensureWindowsShortcut() {
|
|
|
433
440
|
// launches via the global bin (see README "Run via npx" / install one-liner).
|
|
434
441
|
const ico = path.join(PACKAGE_ROOT, "build", "icon.ico");
|
|
435
442
|
const lnk = path.join(DESKTOP_DIR, "CiCy Desktop.lnk");
|
|
443
|
+
if (fs.existsSync(lnk)) return; // idempotent: create only when missing (also avoids re-popping 360 each launch)
|
|
436
444
|
const nodeDir = nodeBinDir();
|
|
437
445
|
const ps = path.join(require("os").tmpdir(), `cicy-shortcut-${process.pid}.ps1`);
|
|
438
446
|
fs.writeFileSync(ps,
|