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 { func Join(parts ...string) string {
if len(parts) == 0 { return filepath.Clean(strings.Join(parts, "/"))
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
} }
// Construct path for given backend.Type and name. // Construct path for given backend.Type and name.