2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

Simplify Implementation of Join

This commit is contained in:
Jan Bader 2015-11-03 18:47:11 +01:00
parent d09e6d5b0f
commit af960b9b40

View File

@ -288,23 +288,7 @@ func (r *SFTP) Create() (backend.Blob, error) {
}
func Join(parts ...string) string {
if len(parts) == 0 {
return ""
}
result := strings.TrimRight(parts[0], "/")
if len(parts) == 1 {
return result
}
for _, s := range parts[1:] {
s = strings.TrimRight(s, "/")
if len(s) == 0 {
continue
}
result = result + "/" + s
}
return result
return filepath.Clean(strings.Join(parts, "/"))
}
// Construct path for given backend.Type and name.