incredible-go-core/pkg/io/files/parent_dir_utils.go

17 lines
281 B
Go
Raw Permalink Normal View History

2024-06-21 17:44:26 +02:00
package files
import (
"path/filepath"
"strings"
)
2024-06-21 17:44:26 +02:00
func GetParentDir(fileLocation string) string {
fileLocation = filepath.ToSlash(fileLocation)
2024-06-21 17:44:26 +02:00
indexOfSlash := strings.LastIndex(fileLocation, "/")
if indexOfSlash > 0 {
return fileLocation[:indexOfSlash]
}
return ""
}