mirror of
https://github.com/beego/bee.git
synced 2024-11-21 18:40:54 +00:00
parent
3e5f9cf213
commit
6a2f44720e
@ -20,7 +20,7 @@ func (c *RenderFile) write(filename string, buf string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
filePath := filepath.Dir(filename)
|
filePath := path.Dir(filename)
|
||||||
err = createPath(filePath)
|
err = createPath(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.New("write create path " + err.Error())
|
err = errors.New("write create path " + err.Error())
|
||||||
@ -37,7 +37,7 @@ func (c *RenderFile) write(filename string, buf string) (err error) {
|
|||||||
name := path.Base(filename)
|
name := path.Base(filename)
|
||||||
|
|
||||||
if utils.IsExist(filename) {
|
if utils.IsExist(filename) {
|
||||||
bakName := fmt.Sprintf("%s/%s.%s.bak", filePathBak, filepath.Base(name), time.Now().Format("2006.01.02.15.04.05"))
|
bakName := fmt.Sprintf("%s/%s.%s.bak", filePathBak, name, time.Now().Format("2006.01.02.15.04.05"))
|
||||||
beeLogger.Log.Infof("bak file '%s'", bakName)
|
beeLogger.Log.Infof("bak file '%s'", bakName)
|
||||||
if err := os.Rename(filename, bakName); err != nil {
|
if err := os.Rename(filename, bakName); err != nil {
|
||||||
err = errors.New("file is bak error, path is " + bakName)
|
err = errors.New("file is bak error, path is " + bakName)
|
||||||
|
Loading…
Reference in New Issue
Block a user