diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-22 21:14:55 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-22 21:14:55 +0200 |
commit | 237f6af4dc74183cf76898ff8f471ab3cb786116 (patch) | |
tree | 547bf4b937141b632e3288f886fe2a208c3f6345 /repo.go | |
parent | db5b7303c254af467a6458d9025f825ab50b452e (diff) | |
download | dna-backup-237f6af4dc74183cf76898ff8f471ab3cb786116.tar.gz dna-backup-237f6af4dc74183cf76898ff8f471ab3cb786116.zip |
fix calling with source "."
Diffstat (limited to 'repo.go')
-rw-r--r-- | repo.go | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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)) |