Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/__tests__/editor-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ describe('getGlobalConfigPath', () => {
expect(getGlobalConfigPath()).toBe(path.join('/some/xdg', 'eca', 'config.json'));
});

it('uses macOS default on darwin when no env override', async () => {
it('uses ~/.config/eca/config.json on darwin when no env override', async () => {
Object.defineProperty(process, 'platform', { value: 'darwin' });
const { getGlobalConfigPath } = await loadConstants();
expect(getGlobalConfigPath()).toBe(
path.join(os.homedir(), 'Library', 'Application Support', 'eca', 'config.json'),
path.join(os.homedir(), '.config', 'eca', 'config.json'),
);
});

Expand Down
7 changes: 1 addition & 6 deletions src/main/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ export function getDataDir(): string {
* 1. `ECA_CONFIG_PATH` environment variable (absolute path), if set.
* 2. `$XDG_CONFIG_HOME/eca/config.json` if `XDG_CONFIG_HOME` is set.
* 3. Platform default:
* - darwin: `~/Library/Application Support/eca/config.json`
* - win32: `%APPDATA%\eca\config.json` (falls back to `~/.config/eca/config.json`)
* - others: `~/.config/eca/config.json`
* - others (macOS, Linux): `~/.config/eca/config.json`
*
* Note: this does not touch the filesystem. Creation is the caller's
* responsibility.
Expand All @@ -56,10 +55,6 @@ export function getGlobalConfigPath(): string {
return path.join(xdg, 'eca', 'config.json');
}

if (process.platform === 'darwin') {
return path.join(os.homedir(), 'Library', 'Application Support', 'eca', 'config.json');
}

if (process.platform === 'win32') {
const appData = process.env.APPDATA;
if (appData && appData.trim().length > 0) {
Expand Down
Loading