mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Changed fs.cpSync to use recursive copying
This commit is contained in:
@ -680,7 +680,7 @@ router.post('/rename', jsonParser, async function (request, response) {
|
|||||||
|
|
||||||
// Rename chats folder
|
// Rename chats folder
|
||||||
if (fs.existsSync(oldChatsPath) && !fs.existsSync(newChatsPath)) {
|
if (fs.existsSync(oldChatsPath) && !fs.existsSync(newChatsPath)) {
|
||||||
fs.cpSync(oldChatsPath, newChatsPath);
|
fs.cpSync(oldChatsPath, newChatsPath, { recursive: true });
|
||||||
fs.rmSync(oldChatsPath, { recursive: true, force: true });
|
fs.rmSync(oldChatsPath, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/users.js
12
src/users.js
@ -286,13 +286,21 @@ async function migrateUserData() {
|
|||||||
// Copy the file to the new location
|
// Copy the file to the new location
|
||||||
fs.cpSync(migration.old, migration.new, { force: true });
|
fs.cpSync(migration.old, migration.new, { force: true });
|
||||||
// Move the file to the backup location
|
// Move the file to the backup location
|
||||||
fs.cpSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
|
fs.cpSync(
|
||||||
|
migration.old,
|
||||||
|
path.join(backupDirectory, path.basename(migration.old)),
|
||||||
|
{ recursive: true, force: true }
|
||||||
|
);
|
||||||
fs.rmSync(migration.old, { recursive: true, force: true });
|
fs.rmSync(migration.old, { recursive: true, force: true });
|
||||||
} else {
|
} else {
|
||||||
// Copy the directory to the new location
|
// Copy the directory to the new location
|
||||||
fs.cpSync(migration.old, migration.new, { recursive: true, force: true });
|
fs.cpSync(migration.old, migration.new, { recursive: true, force: true });
|
||||||
// Move the directory to the backup location
|
// Move the directory to the backup location
|
||||||
fs.cpSync(migration.old, path.join(backupDirectory, path.basename(migration.old)));
|
fs.cpSync(
|
||||||
|
migration.old,
|
||||||
|
path.join(backupDirectory, path.basename(migration.old)),
|
||||||
|
{ recursive: true, force: true }
|
||||||
|
);
|
||||||
fs.rmSync(migration.old, { recursive: true, force: true });
|
fs.rmSync(migration.old, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user