Switched fs.renameSync to fs.copyFileSync

This commit is contained in:
Isaac McFadyen
2024-04-18 15:50:27 -04:00
parent 59bb04f1b3
commit 3822ae9356
6 changed files with 16 additions and 8 deletions

View File

@@ -286,12 +286,14 @@ async function migrateUserData() {
// Copy the file to the new location
fs.cpSync(migration.old, migration.new, { force: true });
// Move the file to the backup location
fs.renameSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
fs.cpSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
fs.rmSync(migration.old, { recursive: true, force: true });
} else {
// Copy the directory to the new location
fs.cpSync(migration.old, migration.new, { recursive: true, force: true });
// Move the directory to the backup location
fs.renameSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
fs.cpSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
fs.rmSync(migration.old, { recursive: true, force: true });
}
} catch (error) {
console.error(color.red(`Error migrating ${migration.old} to ${migration.new}:`), error.message);