当前工作目录为系统临时目录时,gcfg/gview/ghttp模块默认不添加工作目录到搜索路径

This commit is contained in:
John
2018-11-18 19:45:04 +08:00
parent fe753b0bc8
commit ea4764f1f9
2 changed files with 3 additions and 11 deletions

View File

@ -43,7 +43,9 @@ func New(path string, file...string) *Config {
jsons : gmap.NewStringInterfaceMap(),
vc : gtype.NewBool(),
}
c.SetPath(path)
if len(path) > 0 {
c.SetPath(path)
}
return c
}

View File

@ -96,11 +96,6 @@ func New(path...string) *View {
// 设置模板目录绝对路径
func (view *View) SetPath(path string) error {
if p := gfile.RealPath(path); p == "" {
return errors.New(path + " does not exist")
} else {
path = p
}
if rp, err := view.paths.Set(path); err != nil {
glog.Error("gview.SetPath failed:", err.Error())
return err
@ -112,11 +107,6 @@ func (view *View) SetPath(path string) error {
// 添加模板目录搜索路径
func (view *View) AddPath(path string) error {
if p := gfile.RealPath(path); p == "" {
return errors.New(path + " does not exist")
} else {
path = p
}
if rp, err := view.paths.Add(path); err != nil {
glog.Error("gview.AddPath failed:", err.Error())
return err