feat: added dataPath for projects

This commit is contained in:
2026-02-12 15:00:37 +01:00
parent 2b95f3d72c
commit 85d196e598
15 changed files with 263 additions and 49 deletions

View File

@@ -142,9 +142,16 @@ export class PostEngine extends EventEmitter {
await client.execute({ sql: 'DELETE FROM posts_fts WHERE id = ?', args: [id] });
}
private getPostsBaseDir(): string {
private projectBaseDir: string | null = null;
private getProjectBaseDir(): string {
if (this.projectBaseDir) return this.projectBaseDir;
const userDataPath = app.getPath('userData');
return path.join(userDataPath, 'projects', this.currentProjectId, 'posts');
return path.join(userDataPath, 'projects', this.currentProjectId);
}
private getPostsBaseDir(): string {
return path.join(this.getProjectBaseDir(), 'posts');
}
private getPostsDir(): string {
@@ -172,8 +179,9 @@ export class PostEngine extends EventEmitter {
return path.join(dir, `${slug}.md`);
}
setProjectContext(projectId: string): void {
setProjectContext(projectId: string, baseDir?: string): void {
this.currentProjectId = projectId;
this.projectBaseDir = baseDir || null;
}
getProjectContext(): string {