feature: refactoring
This commit is contained in:
parent
6019beffe5
commit
e85baa72f6
@ -3,7 +3,6 @@ package files
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func IsFileExists(fileLocation string) bool {
|
||||
@ -13,13 +12,3 @@ func IsFileExists(fileLocation string) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func GetParentDir(fileLocation string) string {
|
||||
fileLocation = strings.ReplaceAll(fileLocation, "\\", "/")
|
||||
indexOfSlash := strings.LastIndex(fileLocation, "/")
|
||||
if indexOfSlash > 0 {
|
||||
return fileLocation[:indexOfSlash]
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
13
pkg/io/files/parent_dir_utils.go
Normal file
13
pkg/io/files/parent_dir_utils.go
Normal file
@ -0,0 +1,13 @@
|
||||
package files
|
||||
|
||||
import "strings"
|
||||
|
||||
func GetParentDir(fileLocation string) string {
|
||||
fileLocation = strings.ReplaceAll(fileLocation, "\\", "/")
|
||||
indexOfSlash := strings.LastIndex(fileLocation, "/")
|
||||
if indexOfSlash > 0 {
|
||||
return fileLocation[:indexOfSlash]
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
Loading…
Reference in New Issue
Block a user