Skip to content

Commit

Permalink
Merge pull request #2431 from Atralupus/feat/player-overwrite
Browse files Browse the repository at this point in the history
Not remove player folder
  • Loading branch information
Atralupus committed Apr 1, 2024
2 parents 72af47f + e64d56b commit c217a21
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/update/player-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ async function playerUpdate(

const exists = await fs.promises.stat(playerPath).catch(() => false);

if (exists) {
await fs.promises.rm(playerPath, { recursive: true });
if (!exists) {
await fs.promises.mkdir(playerPath, { recursive: true });
}

await fs.promises.mkdir(playerPath, { recursive: true });

console.log("[player] Clean up exists player");

console.log("[player] The 9C player installation path:", playerPath);
Expand All @@ -122,7 +120,7 @@ async function playerUpdate(
try {
await spawnPromise("powershell", [
"-Command",
`Expand-Archive -Path "${dlPath}" -DestinationPath "${playerPath}"`,
`Expand-Archive -Path "${dlPath}" -DestinationPath "${playerPath} -Force"`,
]);
} catch (e) {
win.webContents.send("go to error page", "player", {
Expand Down

0 comments on commit c217a21

Please sign in to comment.