remove Context.Init

This commit is contained in:
Chapuis Bertil
2015-09-06 17:29:52 +02:00
parent a6df1d7d90
commit a6f9e71f95
2 changed files with 6 additions and 7 deletions

View File

@@ -13,14 +13,16 @@ type Context struct {
} }
func NewContext(path string) Context { 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 // Creates the file structure of the Context
func (c *Context) Init() error { func (c *Context) Init() error {
if _, err := os.Stat(c.path); err != nil {
return os.MkdirAll(c.path, backend.Modes.Dir)
}
return nil return nil
} }

View File

@@ -7,9 +7,6 @@ import (
) )
func main() { func main() {
//path, _ := ioutil.TempDir("", "restic-repository-")
//log.Printf("initialize context at %s", path)
context := Context{"/tmp/restic"} context := Context{"/tmp/restic"}
repo, _ := context.Repository("user") repo, _ := context.Repository("user")