2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

Use the platform-independent function for joining

This commit is contained in:
Alexander Neumann 2016-08-11 19:10:51 +02:00
parent 4b8b625b90
commit f6c2787d80

View File

@ -8,13 +8,15 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/juju/errors"
"github.com/pkg/sftp"
"restic/backend" "restic/backend"
"restic/debug" "restic/debug"
"github.com/juju/errors"
"github.com/pkg/sftp"
) )
const ( const (
@ -250,9 +252,10 @@ func (r *SFTP) renameFile(oldname string, t backend.Type, name string) error {
return r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222))) return r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222)))
} }
// Join joins the given paths and cleans them afterwards. // Join joins the given paths and cleans them afterwards. This always uses
// forward slashes, which is required by sftp.
func Join(parts ...string) string { func Join(parts ...string) string {
return filepath.Clean(strings.Join(parts, "/")) return path.Clean(path.Join(parts...))
} }
// Construct path for given backend.Type and name. // Construct path for given backend.Type and name.