Skip to content

Commit 07aaf03

Browse files
committed
Fix app install with executable permissions
1 parent a159ec7 commit 07aaf03

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/classes/ManagerLocal.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
fileCreate,
1414
fileCreateJson,
1515
fileCreateYaml,
16+
fileExec,
1617
fileExists,
1718
fileHash,
1819
fileInstall,
@@ -331,6 +332,43 @@ export class ManagerLocal extends Manager {
331332
dirCreate(dirTarget);
332333
dirMove(dirSource, dirTarget);
333334
fileCreateJson(path.join(dirTarget, 'index.json'), pkgVersion);
335+
// Ensure executable permissions for likely executables inside moved app/project/preset
336+
try {
337+
const movedFiles = dirRead(path.join(dirTarget, '**', '*')).filter(f => !dirIs(f));
338+
movedFiles.forEach((movedFile: string) => {
339+
const ext = path.extname(movedFile).slice(1).toLowerCase();
340+
if (['', 'elf', 'exe'].includes(ext)) {
341+
try {
342+
fileExec(movedFile);
343+
} catch (err) {
344+
this.log(`Failed to set exec on ${movedFile}:`, err);
345+
}
346+
}
347+
});
348+
} catch (err) {
349+
this.log('Error while setting executable permissions:', err);
350+
}
351+
// Also handle macOS .app bundles: set exec on binaries in Contents/MacOS
352+
try {
353+
const appDirs = dirRead(path.join(dirTarget, '**', '*.app')).filter(d => dirIs(d));
354+
appDirs.forEach((appDir: string) => {
355+
try {
356+
const macosBinPattern = path.join(appDir, 'Contents', 'MacOS', '**', '*');
357+
const macosFiles = dirRead(macosBinPattern).filter(f => !dirIs(f));
358+
macosFiles.forEach((binFile: string) => {
359+
try {
360+
fileExec(binFile);
361+
} catch (err) {
362+
this.log(`Failed to set exec on app binary ${binFile}:`, err);
363+
}
364+
});
365+
} catch (err) {
366+
this.log(`Error scanning .app contents for ${appDir}:`, err);
367+
}
368+
});
369+
} catch (err) {
370+
this.log(err);
371+
}
334372
}
335373
}
336374
}

0 commit comments

Comments
 (0)