From 01616f5792f66740b2bf8b17d04b781051902e35 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sun, 5 Apr 2020 16:05:47 +0800 Subject: [PATCH] Workaround for #292 --- patches/conf+6.2.0.patch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/conf+6.2.0.patch diff --git a/patches/conf+6.2.0.patch b/patches/conf+6.2.0.patch new file mode 100644 index 00000000..4b7b2e1a --- /dev/null +++ b/patches/conf+6.2.0.patch @@ -0,0 +1,24 @@ +diff --git a/node_modules/conf/index.js b/node_modules/conf/index.js +index c4daca9..52254f1 100644 +--- a/node_modules/conf/index.js ++++ b/node_modules/conf/index.js +@@ -176,7 +176,18 @@ class Conf { + if (process.env.SNAP) { + fs.writeFileSync(this.path, data); + } else { +- writeFileAtomic.sync(this.path, data); ++ try { ++ writeFileAtomic.sync(this.path, data); ++ } catch (error) { ++ // Fix for https://github.com/sindresorhus/electron-store/issues/106 ++ // Sometimes on Windows, we will get an EXDEV error when atomic writing ++ // (even though to the same directory), so we fall back to non atomic write ++ if (error.code !== 'EXDEV') { ++ throw error; ++ } ++ ++ fs.writeFileSync(this.path, data); ++ } + } + } +