1+ import assert from 'node:assert/strict' ;
12import path from 'node:path' ;
23import fs from 'node:fs' ;
34import {
@@ -9,15 +10,22 @@ import type { InstalledAppInfo, InstallablePackage } from './types';
910import { execute } from '../execute' ;
1011
1112export function installMacDMG ( {
12- appName ,
13+ kind ,
1314 filepath,
14- destinationPath,
15+ sandboxPath,
16+ buildInfo,
1517} : 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+ ) ;
1926
20- execute ( 'hdiutil' , [ 'attach' , filepath ] ) ;
27+ execute ( 'hdiutil' , [ 'attach' , '-mountroot' , sandboxPath , filepath ] ) ;
28+ assert ( fs . existsSync ( volumePath ) , `Expected a mount: ${ volumePath } ` ) ;
2129
2230 try {
2331 fs . cpSync ( path . resolve ( volumePath , appFilename ) , appPath , {
@@ -33,6 +41,7 @@ export function installMacDMG({
3341 assertFileNotQuarantined ( appPath ) ;
3442
3543 return {
44+ appName,
3645 appPath : appPath ,
3746 uninstall : async function ( ) {
3847 /* TODO */
0 commit comments