From 237f6af4dc74183cf76898ff8f471ab3cb786116 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Wed, 22 Sep 2021 21:14:55 +0200 Subject: fix calling with source "." --- repo.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/repo.go b/repo.go index dc61d01..d58eebb 100644 --- a/repo.go +++ b/repo.go @@ -104,7 +104,12 @@ type File struct { } func NewRepo(path string) *Repo { - err := os.MkdirAll(path, 0775) + var err error + path, err = filepath.Abs(path) + if err != nil { + logger.Fatal(err) + } + err = os.MkdirAll(path, 0775) if err != nil { logger.Panic(err) } @@ -139,7 +144,10 @@ func (r *Repo) Patcher() Patcher { } func (r *Repo) Commit(source string) { - source = utils.TrimTrailingSeparator(source) + source, err := filepath.Abs(source) + if err != nil { + logger.Fatal(err) + } versions := r.loadVersions() newVersion := len(versions) // TODO: add newVersion functino newPath := filepath.Join(r.path, fmt.Sprintf(versionFmt, newVersion)) -- cgit v1.2.3