Some slight log improvements
parent
c3cacee55d
commit
eb91e73510
|
@ -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.') }
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue