浏览代码

fix: make sure file exists before checking permissions

Tienson Qin 4 年之前
父节点
当前提交
cd1f68b741
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/electron/electron/handler.cljs

+ 1 - 1
src/electron/electron/handler.cljs

@@ -82,7 +82,7 @@
     (let [^js Buf (.-Buffer buffer)
     (let [^js Buf (.-Buffer buffer)
           ^js content (if (instance? js/ArrayBuffer content)
           ^js content (if (instance? js/ArrayBuffer content)
                         (.from Buf content) content)]
                         (.from Buf content) content)]
-      (when-not (writable? path)
+      (when (and (fs/existsSync path) (not (writable? path)))
         (fs/chmodSync path "644"))
         (fs/chmodSync path "644"))
       (fs/writeFileSync path content)
       (fs/writeFileSync path content)
       (fs/statSync path))
       (fs/statSync path))