MCPcopy Create free account
hub / github.com/compose-spec/compose-go / convertVolumePath

Function convertVolumePath

loader/loader.go:938–949  ·  view source on GitHub ↗

Windows path, c:\\my\\path\\shiny, need to be changed to be compatible with the Engine. Volume path are expected to be linux style /c/my/path/shiny/

(volume types.ServiceVolumeConfig)

Source from the content-addressed store, hash-verified

936// Windows path, c:\\my\\path\\shiny, need to be changed to be compatible with
937// the Engine. Volume path are expected to be linux style /c/my/path/shiny/
938func convertVolumePath(volume types.ServiceVolumeConfig) types.ServiceVolumeConfig {
939 volumeName := strings.ToLower(filepath.VolumeName(volume.Source))
940 if len(volumeName) != 2 {
941 return volume
942 }
943
944 convertedSource := fmt.Sprintf("/%c%s", volumeName[0], volume.Source[len(volumeName):])
945 convertedSource = strings.ReplaceAll(convertedSource, "\\", "/")
946
947 volume.Source = convertedSource
948 return volume
949}

Callers 2

ModelToProjectFunction · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…