forked from vieter-v/vieter
Some slight log improvements
parent
c3cacee55d
commit
eb91e73510
|
@ -88,7 +88,8 @@ fn main() {
|
||||||
|
|
||||||
// This also creates the directories if needed
|
// This also creates the directories if needed
|
||||||
repo := repo.new(repo_dir, pkg_dir) or {
|
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.') }
|
os.mkdir_all(dl_dir) or { exit_with_message(1, 'Failed to create download directory.') }
|
||||||
|
|
|
@ -3,12 +3,6 @@ module repo
|
||||||
import os
|
import os
|
||||||
import package
|
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 &
|
// Dummy struct to work around the fact that you can only share structs, maps &
|
||||||
// arrays
|
// arrays
|
||||||
pub struct Dummy {
|
pub struct Dummy {
|
||||||
|
@ -20,7 +14,7 @@ pub struct Repo {
|
||||||
mut:
|
mut:
|
||||||
mutex shared Dummy
|
mutex shared Dummy
|
||||||
pub:
|
pub:
|
||||||
// Where to store repository files; should exist
|
// Where to store repository files
|
||||||
repo_dir string [required]
|
repo_dir string [required]
|
||||||
// Where to find packages; packages are expected to all be in the same directory
|
// Where to find packages; packages are expected to all be in the same directory
|
||||||
pkg_dir string [required]
|
pkg_dir string [required]
|
||||||
|
@ -29,11 +23,11 @@ pub:
|
||||||
// new creates a new Repo & creates the directories as needed
|
// new creates a new Repo & creates the directories as needed
|
||||||
pub fn new(repo_dir string, pkg_dir string) ?Repo {
|
pub fn new(repo_dir string, pkg_dir string) ?Repo {
|
||||||
if !os.is_dir(repo_dir) {
|
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) {
|
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{
|
return Repo{
|
||||||
|
|
Loading…
Reference in New Issue