79f97c6a3237 — Dang Hoang Tuan (Tsuki) 1 year, 11 months ago
Add a slash (/) at the end of the directory path in case the custom directory path by the user doesn't include it
1 files changed, 5 insertions(+), 0 deletions(-)

M main.go
M main.go +5 -0
@@ 16,6 16,11 @@ func main() {
   os.Exit(cli.Run(new(Flags), func (ctx *cli.Context) error {
     argv := ctx.Argv().(*Flags)
     ctx.String("Port=%d, Directory=%s", argv.Port, argv.Directory)
+    // Add a slash at the end of the directory path in case the user
+    // didn't do so
+    if argv.Directory[len(argv.Directory)] != '/' {
+      argv.Directory += "/"
+    }
     serve(argv.Port, argv.Directory)
     return nil
   }))