From a78d73f5def145f2543cbde84a1b9c55e0624875 Mon Sep 17 00:00:00 2001 From: Andreas Wachter Date: Mon, 4 Dec 2023 13:24:18 +0100 Subject: [PATCH] fix relative path for issues (#189) --- local/local.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/local/local.go b/local/local.go index 2d13643..1eb213b 100644 --- a/local/local.go +++ b/local/local.go @@ -193,18 +193,24 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool { Msg(err.Error()) } } - sub.Info().Str("repo", repo.Name).Msg("backing up issues") - if !dry { - for k, v := range repo.Issues { - jsonData, err := json.Marshal(v) - if err != nil { - sub.Error(). - Msg(err.Error()) - } else { - err = os.WriteFile(filepath.Join(l.Path, fmt.Sprintf("%s.issues", repo.Name), fmt.Sprintf("%s.json", k)), jsonData, 0644) + issuesDir, err := filepath.Abs(fmt.Sprintf("%s.issues", repo.Name)) + if err != nil { + sub.Error(). + Msg(err.Error()) + } else { + sub.Info().Str("repo", repo.Name).Msg("backing up issues") + if !dry { + for k, v := range repo.Issues { + jsonData, err := json.Marshal(v) if err != nil { sub.Error(). Msg(err.Error()) + } else { + err = os.WriteFile(filepath.Join(issuesDir, fmt.Sprintf("%s.json", k)), jsonData, 0644) + if err != nil { + sub.Error(). + Msg(err.Error()) + } } } }