Skip to content

Commit

Permalink
fix: repo not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Mar 14, 2023
1 parent 9138153 commit 46e6301
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,22 @@ func (r *FsRepo) GetDataDir() (string, error) {
}

func NewFsRepo(repoPath string) (Repo, error) {
afterExpand, err := homedir.Expand(repoPath)
var err error
repoPath, err = homedir.Expand(repoPath)
if err != nil {
return nil, fmt.Errorf("expand home dir: %w", err)
}
ret := &FsRepo{
repoPath: afterExpand,
repoPath: repoPath,
configPath: DefaultConfigFile,
dataPath: DefaultDataDir,
tokenPath: DefaultTokenFile,
}
// create repo if not exist
err = makeDir(repoPath)
if err != nil {
return nil, fmt.Errorf("make repo dir: %w", err)
}
return ret, nil
}

Expand Down

0 comments on commit 46e6301

Please sign in to comment.