Convert all paths to absolute
To fix issue where folders were being linked as files
This commit is contained in:
6
util.go
6
util.go
@@ -28,6 +28,12 @@ func FileExists(path string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NormalizePath(input, workdir string) string {
|
func NormalizePath(input, workdir string) string {
|
||||||
|
input = filepath.Clean(input)
|
||||||
|
input, err := filepath.Abs(input)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to get absolute path for %s%s%s: %s%+v%s", SourceColor, input, DefaultColor, ErrorColor, err, DefaultColor)
|
||||||
|
return input
|
||||||
|
}
|
||||||
input = filepath.ToSlash(input)
|
input = filepath.ToSlash(input)
|
||||||
input = strings.ReplaceAll(input, "\"", "")
|
input = strings.ReplaceAll(input, "\"", "")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user