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

@@ -49,14 +49,20 @@ export interface MediaMetadata {
export class MediaEngine extends EventEmitter {
private currentProjectId: string = 'default';
private projectBaseDir: string | null = null;
constructor() {
super();
}
private getMediaBaseDir(): string {
private getProjectBaseDir(): string {
if (this.projectBaseDir) return this.projectBaseDir;
const userDataPath = app.getPath('userData');
return path.join(userDataPath, 'projects', this.currentProjectId, 'media');
return path.join(userDataPath, 'projects', this.currentProjectId);
}
private getMediaBaseDir(): string {
return path.join(this.getProjectBaseDir(), 'media');
}
private getMediaDir(): string {
@@ -85,8 +91,9 @@ export class MediaEngine extends EventEmitter {
return path.join(dir, `${id}${extension}`);
}
setProjectContext(projectId: string): void {
setProjectContext(projectId: string, baseDir?: string): void {
this.currentProjectId = projectId;
this.projectBaseDir = baseDir || null;
}
getProjectContext(): string {
@@ -101,8 +108,7 @@ export class MediaEngine extends EventEmitter {
* Get the thumbnails directory for the current project
*/
private getThumbnailsDir(): string {
const userDataPath = app.getPath('userData');
return path.join(userDataPath, 'projects', this.currentProjectId, 'thumbnails');
return path.join(this.getProjectBaseDir(), 'thumbnails');
}
/**