Skip to content

Commit dfd2da5

Browse files
authored
improve backup dir resolution (#2442)
- get rid of string manipulation which can lead to wrong results when no / at the end - closes #2441
1 parent f6db776 commit dfd2da5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/cli/src/lib/setup/setupBackup.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,11 @@ export class BackupRestore {
148148
}
149149
}
150150

151+
/**
152+
* Get the directory where backups should be stored
153+
*/
151154
static getBackupDir(): string {
152-
const dataDir = path.join(controllerDir, tools.getDefaultDataDir());
153-
154-
const parts = dataDir.split('/');
155-
parts.pop(); // remove data or appName-data
156-
parts.pop();
157-
158-
return path.normalize(`${parts.join('/')}/backups/`);
155+
return path.join(tools.getRootDir(), 'backups/');
159156
}
160157

161158
copyFileSync(source: string, target: string): void {

0 commit comments

Comments
 (0)