Add downloading of main components, fix dir permissions

Fixes #2, #3
This commit is contained in:
Daniel
2019-07-04 13:54:51 +02:00
parent 9636777b30
commit 5b80a0b95e
7 changed files with 67 additions and 56 deletions

View File

@@ -9,10 +9,12 @@ import (
"runtime"
"github.com/safing/portbase/log"
"github.com/safing/portbase/utils"
)
// Errors
var (
ErrNotFound = errors.New("the requested file could not be found")
ErrNotFound = errors.New("the requested file could not be found")
ErrNotAvailableLocally = errors.New("the requested file is not available locally")
)
@@ -81,12 +83,12 @@ func loadOrFetchFile(identifier string, fetch bool) (*File, error) {
}
// check download dir
err := CheckDir(filepath.Join(updateStoragePath, "tmp"))
err := utils.EnsureDirectory(downloadTmpPath, 0755)
if err != nil {
return nil, fmt.Errorf("could not prepare tmp directory for download: %s", err)
}
if (!fetch) {
if !fetch {
return nil, ErrNotAvailableLocally
}