diff options
-rw-r--r-- | src/modules/packages.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/packages.js b/src/modules/packages.js index f868d16..d6420b9 100644 --- a/src/modules/packages.js +++ b/src/modules/packages.js @@ -59,6 +59,13 @@ packages.split_name = (name) => { } packages.list = (dir = packages.path, no_functions) => { + update_path(); + + if (! fs.existsSync(packages.path) + || dir == "R2Northstar/packages") { + return {}; + } + let files = fs.readdirSync(dir); let package_list = {}; @@ -173,6 +180,15 @@ packages.remove = (author, package_name, version) => { packages.install = async (url, author, package_name, version) => { update_path(); + if (! fs.existsSync(packages.path)) { + console.error( + "Can't install package, packages folder doesn't exist", + "and couldn't be created" + ) + + return false; + } + let name = packages.format_name(author, package_name, version); // removes zip's and folders |