Skip to content

Commit 2d01339

Browse files
committed
Adds timestamps to existing backup files if present to avoid deployment errors.
1 parent 69d5840 commit 2d01339

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/electron.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,9 +2077,9 @@ class ElectronLoader {
20772077

20782078
// Backup any existing plugins file
20792079
if (fs.existsSync(pluginListPath)) {
2080-
const backupFile = `${pluginListPath}.sml_bak`;
2081-
if (fs.existsSync(backupFile)) {
2082-
fs.moveSync(backupFile, `${backupFile}_${this.#currentDateTimeAsFileName()}`);
2080+
let backupFile = `${pluginListPath}.sml_bak`;
2081+
while (fs.existsSync(backupFile)) {
2082+
backupFile += `_${this.#currentDateTimeAsFileName()}`;
20832083
}
20842084

20852085
fs.copyFileSync(pluginListPath, backupFile);
@@ -2126,7 +2126,12 @@ class ElectronLoader {
21262126

21272127
// Backup any existing config files
21282128
if (fs.existsSync(configDestPath)) {
2129-
fs.moveSync(configDestPath, path.join(backupDir, configFileName));
2129+
let backupFile = path.join(backupDir, configFileName);
2130+
while (fs.existsSync(backupFile)) {
2131+
backupFile += `_${this.#currentDateTimeAsFileName()}`;
2132+
}
2133+
2134+
fs.moveSync(configDestPath, backupFile);
21302135
}
21312136

21322137
await fs.copyFile(configSrcPath, configDestPath);

0 commit comments

Comments
 (0)