(u *url.URL)
| 230 | } |
| 231 | |
| 232 | func (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 | |
| 253 | func (g *SmbClientGetter) isDirectory(args []string, object string) (bool, error) { |
| 254 | args = append(args, "-c") |
no outgoing calls
no test coverage detected