2020-02-28 15:44:15 +01:00
|
|
|
package vfscommon
|
|
|
|
|
2020-06-02 20:25:59 +02:00
|
|
|
import (
|
|
|
|
"path"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
// OsFindParent returns the parent directory of name, or "" for the
|
|
|
|
// root for OS native paths.
|
|
|
|
func OsFindParent(name string) string {
|
|
|
|
parent := filepath.Dir(name)
|
|
|
|
if parent == "." || parent == "/" {
|
|
|
|
parent = ""
|
|
|
|
}
|
|
|
|
return parent
|
|
|
|
}
|
2020-02-28 15:44:15 +01:00
|
|
|
|
|
|
|
// FindParent returns the parent directory of name, or "" for the root
|
2020-06-02 20:25:59 +02:00
|
|
|
// for rclone paths.
|
2020-02-28 15:44:15 +01:00
|
|
|
func FindParent(name string) string {
|
2020-06-02 20:25:59 +02:00
|
|
|
parent := path.Dir(name)
|
2020-02-28 15:44:15 +01:00
|
|
|
if parent == "." || parent == "/" {
|
|
|
|
parent = ""
|
|
|
|
}
|
|
|
|
return parent
|
|
|
|
}
|