提交 384ca525 作者: Tommi Virtanen

Clean up fsrepo path handling

上级 431cf1c9
...@@ -80,20 +80,15 @@ func open(repoPath string) (repo.Repo, error) { ...@@ -80,20 +80,15 @@ func open(repoPath string) (repo.Repo, error) {
packageLock.Lock() packageLock.Lock()
defer packageLock.Unlock() defer packageLock.Unlock()
r := &FSRepo{ expPath, err := u.TildeExpansion(path.Clean(repoPath))
path: path.Clean(repoPath),
state: unopened, // explicitly set for clarity
}
expPath, err := u.TildeExpansion(r.path)
if err != nil { if err != nil {
return nil, err return nil, err
} }
r.path = expPath
if r.state != unopened { r := &FSRepo{
return nil, debugerror.Errorf("repo is %s", r.state) path: expPath,
} }
if !isInitializedUnsynced(r.path) { if !isInitializedUnsynced(r.path) {
return nil, debugerror.New("ipfs not initialized, please run 'ipfs init'") return nil, debugerror.New("ipfs not initialized, please run 'ipfs init'")
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论