diff --git a/src/main.v b/src/main.v index c3c5ed9..59f6941 100644 --- a/src/main.v +++ b/src/main.v @@ -88,7 +88,8 @@ fn main() { // This also creates the directories if needed repo := repo.new(repo_dir, pkg_dir) or { - exit_with_message(1, 'Failed to create required directories.') + logger.error(err.msg) + exit(1) } os.mkdir_all(dl_dir) or { exit_with_message(1, 'Failed to create download directory.') } diff --git a/src/repo/repo.v b/src/repo/repo.v index ded30ba..1fdcc60 100644 --- a/src/repo/repo.v +++ b/src/repo/repo.v @@ -3,12 +3,6 @@ module repo import os import package -// subpath where the uncompressed version of the files archive is stored -const files_subpath = 'files' - -// subpath where the uncompressed version of the repo archive is stored -const repo_subpath = 'repo' - // Dummy struct to work around the fact that you can only share structs, maps & // arrays pub struct Dummy { @@ -20,7 +14,7 @@ pub struct Repo { mut: mutex shared Dummy pub: - // Where to store repository files; should exist + // Where to store repository files repo_dir string [required] // Where to find packages; packages are expected to all be in the same directory pkg_dir string [required] @@ -29,11 +23,11 @@ pub: // new creates a new Repo & creates the directories as needed pub fn new(repo_dir string, pkg_dir string) ?Repo { if !os.is_dir(repo_dir) { - os.mkdir_all(repo_dir) or { return error('Failed to create repo directory.') } + os.mkdir_all(repo_dir) or { return error('Failed to create repo directory: $err.msg') } } if !os.is_dir(pkg_dir) { - os.mkdir_all(pkg_dir) or { return error('Failed to create package directory.') } + os.mkdir_all(pkg_dir) or { return error('Failed to create package directory: $err.msg') } } return Repo{