MCPcopy Index your code
hub / github.com/dagger/dagger / normalizePath

Function normalizePath

engine/client/pathutil/pathutil.go:39–47  ·  view source on GitHub ↗

normalizePath converts all backslashes to forward slashes and removes trailing slashes. We can't use filepath.ToSlash() as this code always runs inside a Linux container.

(path string)

Source from the content-addressed store, hash-verified

37// normalizePath converts all backslashes to forward slashes and removes trailing slashes.
38// We can't use filepath.ToSlash() as this code always runs inside a Linux container.
39func normalizePath(path string) string {
40 path = filepath.Clean(path)
41 path = strings.ReplaceAll(path, "\\", "/")
42 path = strings.TrimSuffix(path, "/")
43 if path == "" {
44 path = "/"
45 }
46 return path
47}
48
49// GetDrive extracts the drive letter or UNC share from a path.
50func GetDrive(path string) string {

Callers 2

LexicalRelativePathFunction · 0.70
SandboxedRelativePathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected