backend: remove unused Paths variable

This commit is contained in:
Michael Eischer 2022-10-15 16:27:04 +02:00
parent 4ccd5e806b
commit 8c18c65b3b
2 changed files with 2 additions and 21 deletions

View File

@ -2,25 +2,6 @@ package backend
import "os"
// Paths contains the default paths for file-based backends (e.g. local).
var Paths = struct {
Data string
Snapshots string
Index string
Locks string
Keys string
Temp string
Config string
}{
"data",
"snapshots",
"index",
"locks",
"keys",
"tmp",
"config",
}
type Modes struct {
Dir os.FileMode
File os.FileMode

View File

@ -152,7 +152,7 @@ func open(ctx context.Context, sftp *SFTP, cfg Config) (*SFTP, error) {
debug.Log("layout: %v\n", sftp.Layout)
fi, err := sftp.c.Stat(Join(cfg.Path, backend.Paths.Config))
fi, err := sftp.c.Stat(sftp.Layout.Filename(restic.Handle{Type: restic.ConfigFile}))
m := backend.DeriveModesFromFileInfo(fi, err)
debug.Log("using (%03O file, %03O dir) permissions", m.File, m.Dir)
@ -252,7 +252,7 @@ func Create(ctx context.Context, cfg Config) (*SFTP, error) {
sftp.Modes = backend.DefaultModes
// test if config file already exists
_, err = sftp.c.Lstat(Join(cfg.Path, backend.Paths.Config))
_, err = sftp.c.Lstat(sftp.Layout.Filename(restic.Handle{Type: restic.ConfigFile}))
if err == nil {
return nil, errors.New("config file already exists")
}