diff options
Diffstat (limited to 'includes/external/chvfs/index.js')
-rw-r--r-- | includes/external/chvfs/index.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/external/chvfs/index.js b/includes/external/chvfs/index.js index 0dfd958..fda57bf 100644 --- a/includes/external/chvfs/index.js +++ b/includes/external/chvfs/index.js @@ -5,6 +5,7 @@ const watch = require('node-watch'); const child_process = require('child_process'); const fs = require('fs').promises; const fss = require('fs'); +const path = require('path'); process.on('uncaughtException', (e) => { console.error(e); @@ -63,6 +64,7 @@ setInterval(async () => { await fs.unlink("/opt/peh_save/" + item.file.substring(5)); } else { console.log("Copying " + item.file); + try { await fs.mkdir(path.dirname(item.file), { recursive: true }); } catch (e) {} await fs.copyFile(item.file, "/opt/peh_save/" + item.file.substring(5)); } } catch (e) { @@ -83,6 +85,7 @@ process.on('exit', () => { fss.unlinkSync("/opt/peh_save/" + item.file.substring(5)); } else { console.log("Copying " + item.file); + try { fss.mkdirSync(path.dirname(item.file), { recursive: true }); } catch (e) {} fss.copyFileSync(item.file, "/opt/peh_save/" + item.file.substring(5)); } } catch (e) { |