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:
20
src/main/paths.ts
Normal file
20
src/main/paths.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user