MCPcopy Index your code
hub / github.com/coder/coder / windowsJoinPath

Function windowsJoinPath

cli/open.go:570–588  ·  view source on GitHub ↗

windowsJoinPath joins the elements into a path, using Windows path separator and converting forward slashes to backslashes.

(elem ...string)

Source from the content-addressed store, hash-verified

568// windowsJoinPath joins the elements into a path, using Windows path separator
569// and converting forward slashes to backslashes.
570func windowsJoinPath(elem ...string) string {
571 if runtime.GOOS == "windows" {
572 return filepath.Join(elem...)
573 }
574
575 var s string
576 for _, e := range elem {
577 e = unixToWindowsPath(e)
578 if e == "" {
579 continue
580 }
581 if s == "" {
582 s = e
583 continue
584 }
585 s += "\\" + strings.TrimSuffix(e, "\\")
586 }
587 return s
588}
589
590func unixToWindowsPath(p string) string {
591 return strings.ReplaceAll(p, "/", "\\")

Callers 1

resolveAgentAbsPathFunction · 0.85

Calls 1

unixToWindowsPathFunction · 0.85

Tested by

no test coverage detected