1
+ import assert from 'node:assert/strict' ;
1
2
import path from 'node:path' ;
2
3
import fs from 'node:fs' ;
3
4
import {
@@ -9,15 +10,22 @@ import type { InstalledAppInfo, InstallablePackage } from './types';
9
10
import { execute } from '../execute' ;
10
11
11
12
export function installMacDMG ( {
12
- appName ,
13
+ kind ,
13
14
filepath,
14
- destinationPath,
15
+ sandboxPath,
16
+ buildInfo,
15
17
} : InstallablePackage ) : InstalledAppInfo {
16
- const appFilename = `${ appName } .app` ;
17
- const appPath = path . resolve ( destinationPath , appFilename ) ;
18
- const volumePath = `/Volumes/${ appName } ` ;
18
+ assert . equal ( kind , 'osx_dmg' ) ;
19
+ const appName = buildInfo . productName ;
20
+ const appFilename = `${ buildInfo . productName } .app` ;
21
+ const appPath = path . resolve ( sandboxPath , appFilename ) ;
22
+ const volumePath = path . resolve (
23
+ sandboxPath ,
24
+ buildInfo . installerOptions . title
25
+ ) ;
19
26
20
- execute ( 'hdiutil' , [ 'attach' , filepath ] ) ;
27
+ execute ( 'hdiutil' , [ 'attach' , '-mountroot' , sandboxPath , filepath ] ) ;
28
+ assert ( fs . existsSync ( volumePath ) , `Expected a mount: ${ volumePath } ` ) ;
21
29
22
30
try {
23
31
fs . cpSync ( path . resolve ( volumePath , appFilename ) , appPath , {
@@ -33,6 +41,7 @@ export function installMacDMG({
33
41
assertFileNotQuarantined ( appPath ) ;
34
42
35
43
return {
44
+ appName,
36
45
appPath : appPath ,
37
46
uninstall : async function ( ) {
38
47
/* TODO */
0 commit comments