check run

Wide can't run in the OS' temp directory and it can't run with `go run`
This commit is contained in:
Liang Ding 2014-11-23 14:45:55 +08:00
parent 8de1b0a0bc
commit 197385b414
1 changed files with 9 additions and 0 deletions

View File

@ -20,8 +20,10 @@ import (
"math/rand" "math/rand"
"mime" "mime"
"net/http" "net/http"
"os"
"runtime" "runtime"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/b3log/wide/conf" "github.com/b3log/wide/conf"
@ -53,6 +55,13 @@ func init() {
flag.Parse() 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() i18n.Load()
event.Load() event.Load()