diff --git a/server.go b/server.go index 6c79477236..5c3049110b 100644 --- a/server.go +++ b/server.go @@ -22,6 +22,7 @@ import ( "io/ioutil" "log" "net/http" + "os" "path" "path/filepath" "strings" @@ -169,6 +170,10 @@ func splitDirMapping(m string) (string, string) { panic(fmt.Sprintf("invalid directory mapping: want \"remote@local\", got %s", m)) } + if _, err := os.Stat(xs[1]); os.IsNotExist(err){ + panic(fmt.Sprintf("directory does not exist: %s", xs[1])) + } + // Windows prepends the drive letter to the path with a leading slash, e.g. "/foo/" => "C:/foo/". if xs[0][1] == ':' { xs[0] = xs[0][2:]