Skip to content

Commit 12c438d

Browse files
committed
fix: relative path for notarize file
1 parent df2d00d commit 12c438d

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For notarization, you need the following things:
4545

4646
* `options` Object
4747
* `tool` String - The notarization tool to use, default is `notarytool`. Can be `legacy` or `notarytool`. `notarytool` is substantially (10x) faster and `legacy` is deprecated and will **stop working** on November 1st 2023.
48-
* `appPath` String - The absolute path to your `.app` file
48+
* `appPath` String - The absolute path to your `.app`, `.dmg` or `.pkg` file
4949
* There are different options for each tool: Notarytool
5050
* There are three authentication methods available: user name with password:
5151
* `appleId` String - The username of your apple developer account

src/notarytool.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,18 @@ export async function isNotaryToolAvailable() {
4949
export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) {
5050
d('starting notarize process for app:', opts.appPath);
5151
return await withTempDir(async dir => {
52-
const fileExt = path.extname(opts.appPath);
53-
let filePath;
54-
if (fileExt === '.dmg' || fileExt === '.pkg') {
55-
filePath = path.resolve(dir, opts.appPath);
56-
d('attempting to upload file to Apple: ', filePath);
52+
const parsedAppPath = path.parse(opts.appPath);
53+
let filename = opts.appPath;
54+
if (['.dmg', '.pkg'].includes(parsedAppPath.ext)) {
55+
d('attempting to upload file to Apple: ', filename);
5756
} else {
58-
filePath = path.resolve(dir, `${path.parse(opts.appPath).name}.zip`);
59-
d('zipping application to:', filePath);
57+
filename = path.resolve(dir, `${parsedAppPath.name}.zip`);
58+
d('zipping application to:', filename);
6059
const zipResult = await spawn(
6160
'ditto',
62-
['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), filePath],
61+
['-c', '-k', '--sequesterRsrc', '--keepParent', parsedAppPath.base, filename],
6362
{
64-
cwd: path.dirname(opts.appPath),
63+
cwd: parsedAppPath.dir,
6564
},
6665
);
6766
if (zipResult.code !== 0) {
@@ -75,7 +74,7 @@ export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions)
7574
const notarizeArgs = [
7675
'notarytool',
7776
'submit',
78-
filePath,
77+
filename,
7978
...authorizationArgs(opts),
8079
'--wait',
8180
'--output-format',

0 commit comments

Comments
 (0)