| 334 | } |
| 335 | |
| 336 | func splitCpArg(arg string) (ctr, path string) { |
| 337 | if isAbs(arg) { |
| 338 | // Explicit local absolute path, e.g., `C:\foo` or `/foo`. |
| 339 | return "", arg |
| 340 | } |
| 341 | |
| 342 | ctr, path, ok := strings.Cut(arg, ":") |
| 343 | |
| 344 | if !ok || strings.HasPrefix(ctr, ".") { |
| 345 | // Either there's no `:` in the arg |
| 346 | // OR it's an explicit local relative path like `./file:name.txt`. |
| 347 | return "", arg |
| 348 | } |
| 349 | |
| 350 | return ctr, path |
| 351 | } |
| 352 | |
| 353 | func resolveLocalPath(localPath string) (absPath string, err error) { |
| 354 | if absPath, err = filepath.Abs(localPath); err != nil { |