mirror of
https://github.com/audacity/audacity-actions.git
synced 2026-02-03 19:46:20 -06:00
Copy temp dmg to ensure that the file is not locked
This commit is contained in:
parent
6eb5219d0d
commit
0c0c7d9e58
2
dist/package/index.js
vendored
2
dist/package/index.js
vendored
File diff suppressed because one or more lines are too long
@ -201,18 +201,28 @@ async function convertDMG(tempDmgPath, dmgPath) {
|
||||
|
||||
for (let attempt = 1; attempt < maxAttempts; ++attempt) {
|
||||
try {
|
||||
if (fs.existsSync(dmgPath)){
|
||||
if (fs.existsSync(dmgPath)) {
|
||||
fs.rmSync(dmgPath);
|
||||
}
|
||||
|
||||
const newTempPath = tempDmgPath + '.new';
|
||||
|
||||
if (fs.existsSync(newTempPath)) {
|
||||
fs.rmSync(newTempPath);
|
||||
}
|
||||
|
||||
await fs.promises.copyFile(tempDmgPath, newTempPath);
|
||||
|
||||
await helpers.execWithLog('hdiutil', [
|
||||
'convert', tempDmgPath,
|
||||
'convert', newTempPath,
|
||||
'-format', 'UDZO',
|
||||
'-imagekey',
|
||||
'zlib-level=9',
|
||||
'-o', dmgPath
|
||||
]);
|
||||
|
||||
fs.rmSync(newTempPath);
|
||||
|
||||
return;
|
||||
} catch (err) {
|
||||
helpers.error(err.message);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user