Skip to content

Commit 3e8cdb6

Browse files
authored
main: use ToSlash() to specify pkgName
This change allows windows users to specify the package with backslash as a path separator
1 parent 720a54a commit 3e8cdb6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ func main() {
873873
}
874874
pkgName := "."
875875
if flag.NArg() == 1 {
876-
pkgName = flag.Arg(0)
876+
pkgName = filepath.ToSlash(flag.Arg(0))
877877
} else if flag.NArg() > 1 {
878878
fmt.Fprintln(os.Stderr, "build only accepts a single positional argument: package name, but multiple were specified")
879879
usage()
@@ -919,16 +919,17 @@ func main() {
919919
usage()
920920
os.Exit(1)
921921
}
922+
pkgName := filepath.ToSlash(flag.Arg(0))
922923
if command == "flash" {
923-
err := Flash(flag.Arg(0), *port, options)
924+
err := Flash(pkgName, *port, options)
924925
handleCompilerError(err)
925926
} else {
926927
if !options.Debug {
927928
fmt.Fprintln(os.Stderr, "Debug disabled while running gdb?")
928929
usage()
929930
os.Exit(1)
930931
}
931-
err := FlashGDB(flag.Arg(0), *ocdOutput, options)
932+
err := FlashGDB(pkgName, *ocdOutput, options)
932933
handleCompilerError(err)
933934
}
934935
case "run":
@@ -937,12 +938,13 @@ func main() {
937938
usage()
938939
os.Exit(1)
939940
}
940-
err := Run(flag.Arg(0), options)
941+
pkgName := filepath.ToSlash(flag.Arg(0))
942+
err := Run(pkgName, options)
941943
handleCompilerError(err)
942944
case "test":
943945
pkgName := "."
944946
if flag.NArg() == 1 {
945-
pkgName = flag.Arg(0)
947+
pkgName = filepath.ToSlash(flag.Arg(0))
946948
} else if flag.NArg() > 1 {
947949
fmt.Fprintln(os.Stderr, "test only accepts a single positional argument: package name, but multiple were specified")
948950
usage()

0 commit comments

Comments
 (0)