nathanbuchar / electron-settings

📝 A simple persistent user settings framework for Electron.
https://electron-settings.js.org
MIT License
814 stars 60 forks source link

EPERM in windows, rename settings.json.2058848393 to settings.json #159

Closed linonetwo closed 2 years ago

linonetwo commented 2 years ago

Seems similar to https://github.com/nathanbuchar/electron-settings/issues/55

{"code":"EPERM","dest":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json","errno":-4048,"level":"error","path":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json.3730721750","syscall":"rename","timestamp":"2021-10-26T01:04:40.886Z"}
{"code":"EPERM","dest":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json","errno":-4048,"level":"error","path":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json.2058848393","syscall":"rename","timestamp":"2021-10-26T01:12:03.256Z"}
{"code":"EPERM","dest":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json","errno":-4048,"level":"error","path":"C:\\Users\\lambda\\AppData\\Roaming\\TiddlyGit\\settings\\settings.json.44303103","syscall":"rename","timestamp":"2021-10-26T01:12:20.745Z"}

Maybe caused by write-file-atomic package.

linonetwo commented 2 years ago

I hope disable atomicSave will prevent this

settings.configure({
    dir: SETTINGS_FOLDER,
    atomicSave: process.platform !== 'win32',
  });
JCMais commented 2 years ago

setting atomicSave to false fixed it for you @linonetwo ?

linonetwo commented 2 years ago

Haven't tested it yet, one of my users send his log to me, and I'm waiting for him to test this on a windows machine.

linonetwo commented 2 years ago

Yes, seems fixed, but rising another bug...

quanglam2807 commented 1 year ago

This could be fixed by replacing write-file-atomic with https://github.com/fabiospampinato/atomically

linonetwo commented 1 year ago

Thanks @quanglam2807 , best wishes.