MCPcopy
hub / github.com/wavetermdev/waveterm / FixPath

Function FixPath

pkg/util/fileutil/fileutil.go:54–69  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

52}
53
54func FixPath(path string) (string, error) {
55 origPath := path
56 var err error
57 if strings.HasPrefix(path, "~") {
58 path = filepath.Join(wavebase.GetHomeDir(), path[1:])
59 } else if !filepath.IsAbs(path) {
60 path, err = filepath.Abs(path)
61 if err != nil {
62 return "", err
63 }
64 }
65 if strings.HasSuffix(origPath, "/") && !strings.HasSuffix(path, "/") {
66 path += "/"
67 }
68 return path, nil
69}
70
71const (
72 winFlagSoftlink = uint32(0x8000) // FILE_ATTRIBUTE_REPARSE_POINT

Callers 1

fixRelativePathsFunction · 0.92

Calls 1

GetHomeDirFunction · 0.92

Tested by

no test coverage detected