| 598 | } |
| 599 | |
| 600 | func (b *bisyncRun) checkSyntax() (err error) { |
| 601 | // check for odd number of quotes in path, usually indicating an escaping issue |
| 602 | path1 := bilib.FsPath(b.fs1) |
| 603 | path2 := bilib.FsPath(b.fs2) |
| 604 | if strings.Count(path1, `"`)%2 != 0 || strings.Count(path2, `"`)%2 != 0 { |
| 605 | return fmt.Errorf(Color(terminal.RedFg, `detected an odd number of quotes in your path(s). This is usually a mistake indicating incorrect escaping. |
| 606 | Please check your command and try again. Note that on Windows, quoted paths must not have a trailing slash, or it will be interpreted as escaping the quote. path1: %v path2: %v`), path1, path2) |
| 607 | } |
| 608 | // check for other syntax issues |
| 609 | _, err = os.Stat(b.basePath) |
| 610 | if err != nil { |
| 611 | if strings.Contains(err.Error(), "syntax is incorrect") { |
| 612 | return fmt.Errorf(Color(terminal.RedFg, `syntax error detected in your path(s). Please check your command and try again. |
| 613 | Note that on Windows, quoted paths must not have a trailing slash, or it will be interpreted as escaping the quote. path1: %v path2: %v error: %v`), path1, path2, err) |
| 614 | } |
| 615 | } |
| 616 | if runtime.GOOS == "windows" && (strings.Contains(path1, " --") || strings.Contains(path2, " --")) { |
| 617 | return fmt.Errorf(Color(terminal.RedFg, `detected possible flags in your path(s). This is usually a mistake indicating incorrect escaping or quoting (possibly closing quote is missing?). |
| 618 | Please check your command and try again. Note that on Windows, quoted paths must not have a trailing slash, or it will be interpreted as escaping the quote. path1: %v path2: %v`), path1, path2) |
| 619 | } |
| 620 | return nil |
| 621 | } |
| 622 | |
| 623 | func (b *bisyncRun) debug(nametocheck, msgiftrue string) { |
| 624 | if b.DebugName != "" && b.DebugName == nametocheck { |