From e503dffcf3a6e365c90e2c55101d5379f3914a30 Mon Sep 17 00:00:00 2001 From: Kim T Date: Wed, 29 Jul 2026 22:10:56 -0700 Subject: [PATCH] [fix] Correct dirPlugins() default paths to match specification.md dirPlugins() returned bare relative paths that didn't match the spec's directory table: - Linux: spec says $HOME/usr/local/lib, code returned relative "usr/local/lib" with no $HOME and no leading slash - resolves against process.cwd() instead of a stable location. - Windows: spec says C:\Program Files (x86)\Common Files, code returned relative "Program Files\Common Files" - missing the drive letter and "(x86)". Mac was already correct. Linux now joins onto os.homedir() (also keeping the default writable without elevation, consistent with the unprivileged archive-install path in ManagerLocal.install()). Windows now prefers the %ProgramFiles(x86)% env var (matching the existing pattern in dirApp() for %APPDATA%) with the spec's literal path as a fallback. Updated the test that had been asserting the old, buggy values. Note: this changes the default pluginsDir for existing installs on Linux/Windows - anyone relying on the old default location will need to move their files or reconfigure pluginsDir. Co-Authored-By: Claude Sonnet 5 --- src/helpers/file.ts | 8 ++++++-- tests/helpers/file.test.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/helpers/file.ts b/src/helpers/file.ts index d55da3f..a6cff47 100644 --- a/src/helpers/file.ts +++ b/src/helpers/file.ts @@ -190,9 +190,13 @@ export function dirPackage(pkg: PackageInterface) { } export function dirPlugins() { - if (getSystem() === SystemType.Win) return path.join('Program Files', 'Common Files'); + if (getSystem() === SystemType.Win) + return process.env['ProgramFiles(x86)'] || path.join('C:', 'Program Files (x86)', 'Common Files'); else if (getSystem() === SystemType.Mac) return path.join(os.homedir(), 'Library', 'Audio', 'Plug-ins'); - return path.join('usr', 'local', 'lib'); + // Under $HOME rather than the system-wide /usr/local/lib, matching the spec - this keeps the + // default writable without elevation, consistent with the unprivileged archive-install path + // (see ManagerLocal.install()). + return path.join(os.homedir(), 'usr', 'local', 'lib'); } export function dirPresets() { diff --git a/tests/helpers/file.test.ts b/tests/helpers/file.test.ts index 080c603..ea92868 100644 --- a/tests/helpers/file.test.ts +++ b/tests/helpers/file.test.ts @@ -174,11 +174,11 @@ test('Directory package', () => { test('Directory plugins', () => { if (process.platform === 'win32') { - expect(dirPlugins()).toEqual('Program Files\\Common Files'); + expect(dirPlugins()).toEqual(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)\\Common Files'); } else if (process.platform === 'darwin') { expect(dirPlugins()).toEqual(`${os.homedir()}/Library/Audio/Plug-ins`); } else { - expect(dirPlugins()).toEqual('usr/local/lib'); + expect(dirPlugins()).toEqual(`${os.homedir()}/usr/local/lib`); } });