Skip to content

Commit

Permalink
fix: Windows symlink permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Jul 22, 2024
1 parent 2a790e4 commit d495a63
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions packages/main/src/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,20 @@ export async function downloadApp(event: Electron.IpcMainInvokeEvent, url: strin
event.sender.send(IPC_EVENTS.INSTALL_STATE, { type: IPC_EVENT_DATA_TYPE.START });

await decompressFile(file.path, branchPath);
if (fs.existsSync(EXPLORER_LATEST_VERSION_PATH)) {
fs.unlinkSync(EXPLORER_LATEST_VERSION_PATH);
}
fs.symlinkSync(branchPath, EXPLORER_LATEST_VERSION_PATH, 'dir');

if (getOSName() === PLATFORM.MAC) {
const explorerBinPath = join(branchPath, EXPLORER_MAC_BIN_PATH);
if (fs.existsSync(explorerBinPath)) {
fs.chmodSync(explorerBinPath, 0o755);
}
} else if (getOSName() === PLATFORM.WINDOWS) {
// TODO: Implement permissions for Windows
// const explorerBinPath = join(branchPath, EXPLORER_WIN_BIN_PATH);
// if (fs.existsSync(explorerBinPath)) {
// spawn('cmd.exe', [
// '/c',
// join(EXPLORER_PATH, EXPLORER_REGEDIT_PATH),
// EXPLORER_LATEST_VERSION_PATH,
// ]).on('error', error => {
// log.error(error);
// });
// }
}

if (fs.existsSync(EXPLORER_LATEST_VERSION_PATH)) {
fs.unlinkSync(EXPLORER_LATEST_VERSION_PATH);
}

fs.symlinkSync(branchPath, EXPLORER_LATEST_VERSION_PATH, 'junction');

const versionData = {
version: version,
};
Expand Down

0 comments on commit d495a63

Please sign in to comment.