Skip to content

Commit 999a2a7

Browse files
authored
fix: allow tmpdir to be true (#1842)
1 parent 6e69e2d commit 999a2a7

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/common.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ export function isPlatformMac(
9393
return platform === 'darwin' || platform === 'mas';
9494
}
9595

96+
/**
97+
* Gets the tmpdir for packaging. Note that if `opts.tmpdir` is false,
98+
* we're still returning a path.
99+
*/
96100
export function baseTempDir(opts: Options) {
97-
return path.join(opts.tmpdir || os.tmpdir(), 'electron-packager');
101+
return path.join(
102+
typeof opts.tmpdir === 'string' ? opts.tmpdir : os.tmpdir(),
103+
'electron-packager',
104+
);
98105
}
99106

100107
/**

src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,11 @@ export interface Options {
581581
quiet?: boolean;
582582
/**
583583
* The base directory to use as a temporary directory. Set to `false` to disable use of a
584-
* temporary directory. Defaults to the system's temporary directory.
584+
* temporary directory.
585+
*
586+
* @defaultValue Uses the system's temporary directory if `true` or `undefined`.
585587
*/
586-
tmpdir?: string | false;
588+
tmpdir?: string | boolean;
587589
/**
588590
* Human-readable descriptions of how the Electron app uses certain macOS features. These are displayed
589591
* in the App Store. A non-exhaustive list of available properties:

0 commit comments

Comments
 (0)