From a82e9380df16511e071f2d29f12e7c75819d2bb9 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Sat, 13 Oct 2018 19:24:08 -0600 Subject: [PATCH] soething --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 495c3b9..1dffd78 100644 --- a/main.go +++ b/main.go @@ -12,11 +12,19 @@ import ( "flag" "log" "net/http" + "os" + "path" + "path/filepath" ) func main() { + exePath, err := filepath.Abs(filepath.Dir(os.Args[0])) + if err != nil { + panic(err) + } + port := flag.String("p", "8100", "port to serve on") - directory := flag.String("d", ".", "the directory of static file to host") + directory := flag.String("d", path.Join(exePath, "public"), "the directory of static file to host") flag.Parse() http.Handle("/", http.FileServer(http.Dir(*directory)))