aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-13 16:48:16 +0100
committerMinteck <contact@minteck.org>2022-02-13 16:50:05 +0100
commit31a4c90059483c0d0f6cc3251641e35a64fca769 (patch)
tree149ea9f729da43ed07b71599206993298d19be7a
parentd2b8ad9963497a557e7ea1dcef436a793c296846 (diff)
downloadtwilight-31a4c90059483c0d0f6cc3251641e35a64fca769.tar.gz
twilight-31a4c90059483c0d0f6cc3251641e35a64fca769.tar.bz2
twilight-31a4c90059483c0d0f6cc3251641e35a64fca769.zip
Fix upgrade not creating directories (again)
-rw-r--r--hooks/apply_update.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/hooks/apply_update.js b/hooks/apply_update.js
index 8ad9108..411ade8 100644
--- a/hooks/apply_update.js
+++ b/hooks/apply_update.js
@@ -1,4 +1,28 @@
module.exports = (pkg, tempDir) => {
+ const getAllDirs = function(dirPath, arrayOfFiles) {
+ files = fs.readdirSync(dirPath)
+
+ arrayOfFiles = arrayOfFiles || []
+
+ files.forEach(function(file) {
+ if (file !== ".git") {
+ if (fs.statSync(dirPath + "/" + file).isDirectory()) {
+ arrayOfFiles.push(dirPath + "/" + file)
+ arrayOfFiles = getAllDirs(dirPath + "/" + file, arrayOfFiles)
+ }
+ }
+ })
+
+ return arrayOfFiles
+ }
+
+ dirs = getAllDirs(home + "/packages/" + tempDir);
+ for (let dir of dirs) {
+ if (!fs.existsSync(home + "/packages/" + pkg + "/" + dir)) {
+ fs.mkdirSync(home + "/packages/" + pkg + "/" + dir);
+ }
+ }
+
files = require('./files')(tempDir);
for (let file of files) {
if (file.trim() !== "") {