use atomically instead of write-file-atomic

This commit is contained in:
Eugene Pankov
2022-06-15 21:30:03 +02:00
parent ef49aa213e
commit ce351117a5
3 changed files with 10 additions and 26 deletions

View File

@@ -2,7 +2,7 @@ import * as fs from 'mz/fs'
import * as path from 'path'
import * as yaml from 'js-yaml'
import { app } from 'electron'
import writeFileAtomic from 'write-file-atomic'
import { writeFile } from 'atomically'
export function migrateConfig (): void {
@@ -30,6 +30,6 @@ export function loadConfig (): any {
const configPath = path.join(app.getPath('userData'), 'config.yaml')
export async function saveConfig (content: string): Promise<void> {
await writeFileAtomic(configPath, content, { encoding: 'utf8' })
await writeFileAtomic(configPath + '.backup', content, { encoding: 'utf8' })
await writeFile(configPath, content, { encoding: 'utf8' })
await writeFile(configPath + '.backup', content, { encoding: 'utf8' })
}