Skip to content

Commit ba2c8c6

Browse files
committed
fix: use originalFs for all .asar file operations including temp dir writes
1 parent e234235 commit ba2c8c6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

electron/main.cjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,12 @@ async function applyLightweightUpdate() {
738738
}
739739

740740
const tempFile = path.join(tempDir, key)
741-
fs.writeFileSync(tempFile, data)
741+
// Use originalFs for .asar files to bypass Electron's ASAR interception
742+
if (key.endsWith('.asar')) {
743+
originalFs.writeFileSync(tempFile, data)
744+
} else {
745+
fs.writeFileSync(tempFile, data)
746+
}
742747
downloadedFiles.push({ tempFile, destFile: path.join(resourcesPath, key), key })
743748
filesDone++
744749
}
@@ -759,8 +764,8 @@ async function applyLightweightUpdate() {
759764
}
760765
}
761766

762-
// Clean up temp files
763-
try { fs.rmSync(tempDir, { recursive: true, force: true }) } catch { /* ignore */ }
767+
// Clean up temp files using originalFs.rmSync for .asar compatibility
768+
try { originalFs.rmSync(tempDir, { recursive: true, force: true }) } catch { /* ignore */ }
764769

765770
updateState = { ...updateState, downloading: false, progress: 100 }
766771
notifyUpdateState()

0 commit comments

Comments
 (0)