diff options
| author | ruki <[email protected]> | 2025-11-26 22:32:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-26 22:32:50 +0800 |
| commit | fe96cdcbaa858ebcec0935d42b3409487e05e511 (patch) | |
| tree | e45f261f0f1ebfcfd46ab45ccf2e3c1b7ebecd9e | |
| parent | 46c195785c1d52841df7500f40bba59c144cd536 (diff) | |
use builddir
| -rw-r--r-- | xmake/plugins/pack/dmg/main.lua | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xmake/plugins/pack/dmg/main.lua b/xmake/plugins/pack/dmg/main.lua index 51520c79c..54fb30f5a 100644 --- a/xmake/plugins/pack/dmg/main.lua +++ b/xmake/plugins/pack/dmg/main.lua @@ -49,21 +49,23 @@ function _pack_dmg(package) local outputfile = package:outputfile() os.tryrm(outputfile) - -- create temporary directory for DMG - local tmpdir = os.tmpfile() .. ".dir" - os.mkdir(tmpdir) + -- create directory for DMG in builddir + local builddir = package:builddir() + local dmgdir = path.join(builddir, "dmg") + os.tryrm(dmgdir) + os.mkdir(dmgdir) - -- copy files to temporary directory + -- copy files to DMG directory local dmgname = path.basename(outputfile, ".dmg") - local dmgdir = path.join(tmpdir, dmgname) - os.cp(rootdir, dmgdir) + local dmgcontentdir = path.join(dmgdir, dmgname) + os.cp(rootdir, dmgcontentdir) -- create DMG using hdiutil -- create a read-only DMG with UDZO format (compressed) local argv = { "create", "-volname", package:title() or package:name() or dmgname, - "-srcfolder", dmgdir, + "-srcfolder", dmgcontentdir, "-ov", "-format", "UDZO", outputfile @@ -72,9 +74,6 @@ function _pack_dmg(package) -- run hdiutil os.vrunv(hdiutil.program, argv) - -- clean temporary directory - os.rm(tmpdir) - -- verify DMG was created assert(os.isfile(outputfile), "generate %s failed!", outputfile) end |
