diff --git a/commands/command.go b/commands/command.go index 076c74dd..44e03a4a 100644 --- a/commands/command.go +++ b/commands/command.go @@ -60,9 +60,16 @@ func RegisterDataBase() { if strings.HasPrefix(database, "./") { database = filepath.Join(conf.WorkingDirectory, string(database[1:])) } + if p,err := filepath.Abs(database); err == nil { + database = p + } dbPath := filepath.Dir(database) - os.MkdirAll(dbPath, 0777) + + if _,err := os.Stat(dbPath); err != nil && os.IsNotExist(err) { + os.MkdirAll(dbPath, 0777) + } + err := orm.RegisterDataBase("default", "sqlite3", database) diff --git a/commands/daemon/daemon.go b/commands/daemon/daemon.go index c8f4617b..ddf35186 100644 --- a/commands/daemon/daemon.go +++ b/commands/daemon/daemon.go @@ -9,6 +9,7 @@ import ( "github.com/lifei6671/mindoc/commands" "github.com/lifei6671/mindoc/conf" "github.com/lifei6671/mindoc/controllers" + "path/filepath" ) type Daemon struct { @@ -51,7 +52,13 @@ func (d *Daemon) Run() { beego.ErrorController(&controllers.ErrorController{}) - fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, os.Args[0], conf.GO_VERSION) + f,err := filepath.Abs(os.Args[0]) + + if err != nil { + f = os.Args[0] + } + + fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, f, conf.GO_VERSION) beego.Run() } diff --git a/conf/enumerate.go b/conf/enumerate.go index 829e52d9..59d86bb8 100644 --- a/conf/enumerate.go +++ b/conf/enumerate.go @@ -19,7 +19,6 @@ const CaptchaSessionName = "__captcha__" const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" //允许用户名中出现点号 - const RegexpAccount = `^[a-zA-Z][a-zA-z0-9\.]{2,50}$` // PageSize 默认分页条数. @@ -75,7 +74,7 @@ var ( // app_key func GetAppKey() string { - return beego.AppConfig.DefaultString("app_key", "godoc") + return beego.AppConfig.DefaultString("app_key", "mindoc") } func GetDatabasePrefix() string { @@ -315,4 +314,16 @@ func WorkingDir(elem ...string) string { elems := append([]string{ WorkingDirectory },elem...) return filepath.Join(elems...) +} + +func init() { + if p,err := filepath.Abs("./conf/app.conf"); err == nil { + ConfigurationFile = p + } + if p,err := filepath.Abs("./"); err == nil { + WorkingDirectory = p + } + if p,err := filepath.Abs("./runtime/logs"); err == nil { + LogFile = p + } } \ No newline at end of file diff --git a/static/css/export.css b/static/css/export.css index b640a5d6..f628d445 100644 --- a/static/css/export.css +++ b/static/css/export.css @@ -8,4 +8,10 @@ body{ } .editormd-preview-container{ padding: 0 !important; +} + +.markdown-body pre{ + max-height: none !important; + white-space: pre-wrap !important; + word-wrap: break-word !important; } \ No newline at end of file