1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

Clean up fsrepo path handling

This commit is contained in:
Tommi Virtanen
2015-03-13 16:02:14 -07:00
parent 431cf1c902
commit 384ca525b4

View File

@ -80,20 +80,15 @@ func open(repoPath string) (repo.Repo, error) {
packageLock.Lock()
defer packageLock.Unlock()
r := &FSRepo{
path: path.Clean(repoPath),
state: unopened, // explicitly set for clarity
}
expPath, err := u.TildeExpansion(r.path)
expPath, err := u.TildeExpansion(path.Clean(repoPath))
if err != nil {
return nil, err
}
r.path = expPath
if r.state != unopened {
return nil, debugerror.Errorf("repo is %s", r.state)
r := &FSRepo{
path: expPath,
}
if !isInitializedUnsynced(r.path) {
return nil, debugerror.New("ipfs not initialized, please run 'ipfs init'")
}