MCPcopy
hub / github.com/hashicorp/go-getter / findHostAndFilePath

Method findHostAndFilePath

get_smbclient.go:232–251  ·  view source on GitHub ↗
(u *url.URL)

Source from the content-addressed store, hash-verified

230}
231
232func (g *SmbClientGetter) findHostAndFilePath(u *url.URL) (string, string, error) {
233 // Host path
234 hostPath := "//" + u.Host
235
236 // Get shared directory
237 path := strings.TrimPrefix(u.Path, "/")
238 splt := regexp.MustCompile(`/`)
239 directories := splt.Split(path, 2)
240
241 if len(directories) > 0 {
242 hostPath = hostPath + "/" + directories[0]
243 }
244
245 // Check file path
246 if len(directories) <= 1 || directories[1] == "" {
247 return "", "", fmt.Errorf("can not find file path and/or name in the smb url")
248 }
249
250 return hostPath, directories[1], nil
251}
252
253func (g *SmbClientGetter) isDirectory(args []string, object string) (bool, error) {
254 args = append(args, "-c")

Callers 3

smbClientModeMethod · 0.95
smbclientGetMethod · 0.95
smbclientGetFileMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected