From 2b6f8b5a3919e49b91cc40aac74f829f97c80816 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 27 Dec 2020 13:51:15 +0000 Subject: [PATCH] Enable use of Native FS with NWJS Former-commit-id: ec8d5cb4a8740cab772c96a55ea0c8476f982cf7 [formerly 9414582f7871508a112da8ac5e0fdd743ca6d577] [formerly 375cebd89f97e34f185cb98c45a2ed6d7910e275] [formerly 8446ca6a48adc54c2af3f2ff51c2518facfba8b4 [formerly 2d48af1287b4025785dbfed2674e8fb8395bcf3b [formerly 5be86a45b6197fa3028a01327383fd9b16a0e41a]]] Former-commit-id: b2a99ee393a49749019899cb3eb8dffcfa5e6fe8 [formerly cad8f01644a95fe4f81c1406594374f8f4479b32 [formerly 7939386193c383ea6686c537b37d809d1ca956e5]] Former-commit-id: c944303c8ea812c2733ae214393b460443a473e5 [formerly 6312434710b6d423e3d35fb7f753bb8f1b257dbd] Former-commit-id: e59a34d9e643b76662ac4096fa6e3773980b711b --- www/index.html | 7 +++++-- www/js/app.js | 22 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/www/index.html b/www/index.html index 57898650..c7b2bd4f 100644 --- a/www/index.html +++ b/www/index.html @@ -55,7 +55,10 @@ if (typeof window.nw !== 'undefined') { window.requireNode = window.require; window.require = undefined; - window.fs = requireNode('fs'); + // If Native FS is unavailable, we'll use NWJS fs + if (typeof window.showOpenFilePicker === 'undefined') { + window.fs = requireNode('fs'); + } } if ('serviceWorker' in navigator && /^http/.test(window.location.protocol)) { console.log('Trying to activate Service Worker...'); @@ -113,7 +116,7 @@

Changes in version 1.0