Skip to content

Commit

Permalink
fix: use target platform path separators for asar integrity keys (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored Nov 12, 2024
1 parent 7024c67 commit 6270eeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ export class MacApp extends App implements Plists {
return [...plists, ...(optional as LoadPlistParams[]).filter(item => item)];
}

appRelativePath(p: string) {
return path.relative(this.contentsPath, p);
appRelativePlatformPath(p: string) {
return path.posix.relative(this.contentsPath, p);
}

async updatePlistFiles() {
Expand Down
12 changes: 8 additions & 4 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class App {
if (this.opts.prebuiltAsar) {
await this.copyPrebuiltAsar();
this.asarIntegrity = {
[this.appRelativePath(this.appAsarPath)]: this.getAsarIntegrity(this.appAsarPath),
[this.appRelativePlatformPath(this.appAsarPath)]: this.getAsarIntegrity(this.appAsarPath),
};
} else {
await this.buildApp();
Expand Down Expand Up @@ -232,8 +232,12 @@ export class App {
await fs.copy(src, this.appAsarPath, { overwrite: false, errorOnExist: true });
}

appRelativePath(p: string) {
return path.relative(this.stagingPath, p);
appRelativePlatformPath(p: string) {
if (this.opts.platform === 'win32') {
return path.win32.relative(this.stagingPath, p);
}

return path.posix.relative(this.stagingPath, p);
}

async asarApp() {
Expand All @@ -247,7 +251,7 @@ export class App {

await asar.createPackageWithOptions(this.originalResourcesAppDir, this.appAsarPath, this.asarOptions);
this.asarIntegrity = {
[this.appRelativePath(this.appAsarPath)]: this.getAsarIntegrity(this.appAsarPath),
[this.appRelativePlatformPath(this.appAsarPath)]: this.getAsarIntegrity(this.appAsarPath),
};
await fs.remove(this.originalResourcesAppDir);

Expand Down

0 comments on commit 6270eeb

Please sign in to comment.