14 lines
272 B
Go
14 lines
272 B
Go
|
package files
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
func GetParentDir(fileLocation string) string {
|
||
|
fileLocation = strings.ReplaceAll(fileLocation, "\\", "/")
|
||
|
indexOfSlash := strings.LastIndex(fileLocation, "/")
|
||
|
if indexOfSlash > 0 {
|
||
|
return fileLocation[:indexOfSlash]
|
||
|
}
|
||
|
|
||
|
return ""
|
||
|
}
|