From 197385b4144a4fd0e30896b9659aa97d9a8432c2 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 23 Nov 2014 14:45:55 +0800 Subject: [PATCH] check run Wide can't run in the OS' temp directory and it can't run with `go run` --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 20a5ef8..73cfff6 100644 --- a/main.go +++ b/main.go @@ -20,8 +20,10 @@ import ( "math/rand" "mime" "net/http" + "os" "runtime" "strconv" + "strings" "time" "github.com/b3log/wide/conf" @@ -53,6 +55,13 @@ func init() { flag.Parse() + wd := util.OS.Pwd() + if strings.HasPrefix(wd, os.TempDir()) { + glog.Error("Wide can't run in the OS' temp directory and it can't run with `go run`") + + os.Exit(-1) + } + i18n.Load() event.Load()