mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
remove Context.Init
This commit is contained in:
10
context.go
10
context.go
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user