Skip to content

Commit

Permalink
improve backup dir resolution (#2442)
Browse files Browse the repository at this point in the history
- get rid of string manipulation which can lead to wrong results when no / at the end
- closes #2441
  • Loading branch information
foxriver76 authored Sep 20, 2023
1 parent f6db776 commit dfd2da5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/cli/src/lib/setup/setupBackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,11 @@ export class BackupRestore {
}
}

/**
* Get the directory where backups should be stored
*/
static getBackupDir(): string {
const dataDir = path.join(controllerDir, tools.getDefaultDataDir());

const parts = dataDir.split('/');
parts.pop(); // remove data or appName-data
parts.pop();

return path.normalize(`${parts.join('/')}/backups/`);
return path.join(tools.getRootDir(), 'backups/');
}

copyFileSync(source: string, target: string): void {
Expand Down

0 comments on commit dfd2da5

Please sign in to comment.