From 903bc4a145893ad65f0815bded37f7cab163ebff Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 10 May 2015 17:08:04 +0900 Subject: [PATCH] Cleanup --- mount.go | 15 ++++----------- version.go | 12 ++++++++++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/mount.go b/mount.go index 1e64ca1..fbeadf9 100644 --- a/mount.go +++ b/mount.go @@ -2,22 +2,14 @@ package main import ( - "flag" - "fmt" - "os" - "bazil.org/fuse" "bazil.org/fuse/fs" - _ "bazil.org/fuse/fs/fstestutil" + // "flag" + // "fmt" "golang.org/x/net/context" + "os" ) -var Usage = func() { - fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) - fmt.Fprintf(os.Stderr, " %s MOUNTPOINT\n", os.Args[0]) - flag.PrintDefaults() -} - // func main() { // flag.Usage = Usage // flag.Parse() @@ -68,6 +60,7 @@ func (Dir) Attr(a *fuse.Attr) { } func (Dir) Lookup(ctx context.Context, name string) (fs.Node, error) { + if name == "hello" { return File{}, nil } diff --git a/version.go b/version.go index 1bec811..fb71c7a 100644 --- a/version.go +++ b/version.go @@ -60,12 +60,16 @@ func newVersion(base string, parent *version) (*version, error) { return nil, err } - version := &version{ + ver := &version{ base: base, parent: parent, timestamp: time.Unix(timeval, 0)} - return version, nil + if err := ver.loadMetadata(); err != nil { + return nil, err + } + + return ver, nil } func (this *version) loadMetadata() error { @@ -98,3 +102,7 @@ func (this *version) saveMetadata() error { func (this *version) metadataPath() string { return filepath.Join(this.base, "meta.json") } + +func (this *version) rootPath() string { + return filepath.Join(this.base, "root") +}