diff --git a/context.go b/context.go index d1907b9..cc23200 100644 --- a/context.go +++ b/context.go @@ -13,14 +13,16 @@ type Context struct { } func NewContext(path string) Context { - return Context{filepath.Clean(path)} + path = filepath.Clean(path) + if _, err := os.Stat(path); err != nil { + os.MkdirAll(path, backend.Modes.Dir) + } + return Context{path} } // Creates the file structure of the Context func (c *Context) Init() error { - if _, err := os.Stat(c.path); err != nil { - return os.MkdirAll(c.path, backend.Modes.Dir) - } + return nil } diff --git a/server.go b/server.go index 0483440..38365d8 100644 --- a/server.go +++ b/server.go @@ -7,9 +7,6 @@ import ( ) func main() { - //path, _ := ioutil.TempDir("", "restic-repository-") - //log.Printf("initialize context at %s", path) - context := Context{"/tmp/restic"} repo, _ := context.Repository("user")