From 8c18c65b3b0d4d318c21c2aac7964444d4f60599 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 15 Oct 2022 16:27:04 +0200 Subject: [PATCH] backend: remove unused Paths variable --- internal/backend/paths.go | 19 ------------------- internal/backend/sftp/sftp.go | 4 ++-- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/internal/backend/paths.go b/internal/backend/paths.go index eaa1a433a..7e511be9c 100644 --- a/internal/backend/paths.go +++ b/internal/backend/paths.go @@ -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 diff --git a/internal/backend/sftp/sftp.go b/internal/backend/sftp/sftp.go index deebb6e7c..417b6681a 100644 --- a/internal/backend/sftp/sftp.go +++ b/internal/backend/sftp/sftp.go @@ -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") }