Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use target platform path separators for asar integrity keys #1781

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: use target platform path separators for asar integrity keys
MarshallOfSound committed Nov 12, 2024
commit 4fe36b1cbe4a579b3207d5664cd3b396ad2faba5
4 changes: 2 additions & 2 deletions src/mac.ts
Original file line number Diff line number Diff line change
@@ -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() {
12 changes: 8 additions & 4 deletions src/platform.ts
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@
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();
@@ -232,8 +232,12 @@
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);

Check warning on line 237 in src/platform.ts

Codecov / codecov/patch

src/platform.ts#L237

Added line #L237 was not covered by tests
}

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

async asarApp() {
@@ -247,7 +251,7 @@

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);