ensure config saves don't overwrite each other

This commit is contained in:
Eugene Pankov 2022-02-16 21:26:57 +01:00
parent bf893551c8
commit 3eb4bd53a9
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -119,7 +119,7 @@ export class ElectronPlatformService extends PlatformService {
}
async _saveConfigInternal (content: string): Promise<void> {
const tempPath = this.configPath + '.new'
const tempPath = this.configPath + '.new.' + Date.now().toString()
await fs.writeFile(tempPath, content, 'utf8')
await fs.writeFile(this.configPath + '.backup', content, 'utf8')
await promisify(gracefulFS.rename)(tempPath, this.configPath)