remove gfile.MainPkgPath check in gcfg/gview default path

This commit is contained in:
John
2018-12-19 14:51:09 +08:00
parent a86f4f8e23
commit 74bc36a2dc
3 changed files with 4 additions and 20 deletions

View File

@ -76,10 +76,7 @@ func View(name...string) *gview.View {
if path == "" {
path = genv.Get("GF_VIEWPATH")
if path == "" {
// gfile.MainPkgPath() 用以判断是否开发环境
if gfile.MainPkgPath() == "" {
path = gfile.SelfDir()
}
path = gfile.SelfDir()
}
}
view := gview.New(path)
@ -106,10 +103,7 @@ func Config(file...string) *gcfg.Config {
if path == "" {
path = genv.Get("GF_CFGPATH")
if path == "" {
// gfile.MainPkgPath() 用以判断是否开发环境
if gfile.MainPkgPath() == "" {
path = gfile.SelfDir()
}
path = gfile.SelfDir()
}
}
config := gcfg.New(path, configFile)

View File

@ -7,9 +7,7 @@
package gfsnotify
import (
"fmt"
"gitee.com/johng/gf/g/container/glist"
"os"
)
// 监听循环
@ -33,8 +31,8 @@ func (w *Watcher) startWatchLoop() {
return struct {}{}
}, REPEAT_EVENT_FILTER_INTERVAL)
case err := <- w.watcher.Errors:
fmt.Fprintf(os.Stderr, "[gfsnotify] error: %s\n", err.Error())
case <- w.watcher.Errors:
//fmt.Fprintf(os.Stderr, "[gfsnotify] error: %s\n", err.Error())
}
}
}()

View File

@ -11,7 +11,6 @@ package glog
import (
"gitee.com/johng/gf/g/container/gtype"
"gitee.com/johng/gf/g/os/gfile"
"io"
)
@ -33,13 +32,6 @@ var (
logger = New()
)
func init() {
// 自动识别开发环境
if gfile.MainPkgPath() != "" {
logger.SetDebug(true)
}
}
// 日志日志目录绝对路径
func SetPath(path string) {
logger.SetPath(path)