aboutsummaryrefslogtreecommitdiff
path: root/hooks/apply_update.js
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/apply_update.js')
-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() !== "") {