fix: use original-fs to bypass Electron asar interception
This commit is contained in:
+6
-5
@@ -1,6 +1,7 @@
|
||||
import { app, BrowserWindow, Menu, clipboard, ipcMain, safeStorage, session, shell } from 'electron';
|
||||
import { join, dirname } from 'path';
|
||||
import { existsSync, mkdirSync, unlinkSync, promises as fsp } from 'fs';
|
||||
import { existsSync, mkdirSync, promises as fsp } from 'fs';
|
||||
import { existsSync as origExistsSync, unlinkSync as origUnlinkSync } from 'original-fs';
|
||||
import { get as httpsGet } from 'https';
|
||||
import { execFile } from 'child_process';
|
||||
import * as os from 'os';
|
||||
@@ -179,8 +180,8 @@ app.whenReady().then(async () => {
|
||||
// Clean up stale pending asar from a previous failed swap
|
||||
const resourcesDir = join(dirname(app.getPath('exe')), 'resources');
|
||||
const stalePending = join(resourcesDir, 'app-pending.asar');
|
||||
if (existsSync(stalePending)) {
|
||||
try { unlinkSync(stalePending); } catch { /* ignore */ }
|
||||
if (origExistsSync(stalePending)) {
|
||||
try { origUnlinkSync(stalePending); } catch { /* ignore */ }
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -213,8 +214,8 @@ app.whenReady().then(async () => {
|
||||
} catch (err) {
|
||||
electronLog.error('[KCC] Patch download failed:', err);
|
||||
// Clean up failed download
|
||||
if (existsSync(pendingPath)) {
|
||||
try { unlinkSync(pendingPath); } catch { /* ignore */ }
|
||||
if (origExistsSync(pendingPath)) {
|
||||
try { origUnlinkSync(pendingPath); } catch { /* ignore */ }
|
||||
}
|
||||
if (!updateWin.isDestroyed()) updateWin.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user