@open-audio-stack/core 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import path from 'path';
2
2
  import { Package } from './Package.js';
3
3
  import { Manager } from './Manager.js';
4
- import { archiveExtract, dirCreate, dirDelete, dirEmpty, dirIs, dirMove, dirRead, fileCreate, fileCreateJson, fileCreateYaml, fileExists, fileHash, fileInstall, fileOpen, fileReadJson, fileReadYaml, filesMove, isAdmin, runCliAsAdmin, } from '../helpers/file.js';
4
+ import { archiveExtract, dirCreate, dirDelete, dirEmpty, dirIs, dirMove, dirRead, fileCreate, fileCreateJson, fileCreateYaml, fileExec, fileExists, fileHash, fileInstall, fileOpen, fileReadJson, fileReadYaml, filesMove, isAdmin, runCliAsAdmin, } from '../helpers/file.js';
5
5
  import { isValidVersion, pathGetSlug, pathGetVersion, toSlug } from '../helpers/utils.js';
6
6
  import { commandExists, getArchitecture, getSystem, isTests } from '../helpers/utilsLocal.js';
7
7
  import { apiBuffer } from '../helpers/api.js';
@@ -296,6 +296,48 @@ export class ManagerLocal extends Manager {
296
296
  dirCreate(dirTarget);
297
297
  dirMove(dirSource, dirTarget);
298
298
  fileCreateJson(path.join(dirTarget, 'index.json'), pkgVersion);
299
+ // Ensure executable permissions for likely executables inside moved app/project/preset
300
+ try {
301
+ const movedFiles = dirRead(path.join(dirTarget, '**', '*')).filter(f => !dirIs(f));
302
+ movedFiles.forEach((movedFile) => {
303
+ const ext = path.extname(movedFile).slice(1).toLowerCase();
304
+ if (['', 'elf', 'exe'].includes(ext)) {
305
+ try {
306
+ fileExec(movedFile);
307
+ }
308
+ catch (err) {
309
+ this.log(`Failed to set exec on ${movedFile}:`, err);
310
+ }
311
+ }
312
+ });
313
+ }
314
+ catch (err) {
315
+ this.log('Error while setting executable permissions:', err);
316
+ }
317
+ // Also handle macOS .app bundles: set exec on binaries in Contents/MacOS
318
+ try {
319
+ const appDirs = dirRead(path.join(dirTarget, '**', '*.app')).filter(d => dirIs(d));
320
+ appDirs.forEach((appDir) => {
321
+ try {
322
+ const macosBinPattern = path.join(appDir, 'Contents', 'MacOS', '**', '*');
323
+ const macosFiles = dirRead(macosBinPattern).filter(f => !dirIs(f));
324
+ macosFiles.forEach((binFile) => {
325
+ try {
326
+ fileExec(binFile);
327
+ }
328
+ catch (err) {
329
+ this.log(`Failed to set exec on app binary ${binFile}:`, err);
330
+ }
331
+ });
332
+ }
333
+ catch (err) {
334
+ this.log(`Error scanning .app contents for ${appDir}:`, err);
335
+ }
336
+ });
337
+ }
338
+ catch (err) {
339
+ this.log(err);
340
+ }
299
341
  }
300
342
  }
301
343
  }
@@ -385,14 +427,16 @@ export class ManagerLocal extends Manager {
385
427
  try {
386
428
  const openPath = openableFile.open;
387
429
  const fileExt = path.extname(openPath).slice(1).toLowerCase();
388
- let formatDir = pluginFormatDir[fileExt] || 'Plugin';
389
- if (this.type === RegistryType.Apps)
390
- formatDir = pluginFormatDir[fileExt] || 'App';
391
- else if (this.type === RegistryType.Presets)
392
- formatDir = presetFormatDir[fileExt] || 'Preset';
393
- else if (this.type === RegistryType.Projects)
394
- formatDir = projectFormatDir[fileExt] || 'Project';
395
- const packageDir = path.join(this.typeDir, formatDir, slug, versionNum);
430
+ let packageDir;
431
+ if (this.type === RegistryType.Plugins) {
432
+ // For plugins, use type-specific subdirectories
433
+ const formatDir = pluginFormatDir[fileExt] || 'Plugin';
434
+ packageDir = path.join(this.typeDir, formatDir, slug, versionNum);
435
+ }
436
+ else {
437
+ // For apps/projects/presets, files are in direct package directory
438
+ packageDir = path.join(this.typeDir, slug, versionNum);
439
+ }
396
440
  let fullPath;
397
441
  if (path.isAbsolute(openPath)) {
398
442
  fullPath = openPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",