feat(paths): per-profile directory resolver

Task 5 of the slice plan. resolveProfilePaths(profile='default')
returns { profileDir, dbFile, mediaDir } under
{userData}/Inkling/profiles/<profile>/ and ensures mediaDir exists
via recursive mkdirSync. Slice scope is single profile 'default'
(spec §1.1, §2.4).

Verification: `npm run typecheck` exits 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
altair823
2026-04-25 12:00:55 +09:00
parent 71eff35d68
commit 8f174cb569

20
src/main/paths.ts Normal file
View File

@@ -0,0 +1,20 @@
import { app } from 'electron';
import { join } from 'node:path';
import { mkdirSync } from 'node:fs';
export interface ProfilePaths {
profileDir: string;
dbFile: string;
mediaDir: string;
}
export function resolveProfilePaths(profile = 'default'): ProfilePaths {
const root = join(app.getPath('userData'), 'Inkling', 'profiles', profile);
const p: ProfilePaths = {
profileDir: root,
dbFile: join(root, 'inkling.sqlite'),
mediaDir: join(root, 'media')
};
mkdirSync(p.mediaDir, { recursive: true });
return p;
}