Mercurial > hg > Members > anatofuz > growsync
view util.go @ 14:1e21b0c29775
remove create page msg
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 17 Dec 2020 11:12:04 +0900 |
parents | af840bc25791 |
children | 0dc44ee170b4 |
line wrap: on
line source
package growsync import ( "os" "path/filepath" "strings" ) func convertGrowiSystemPath(inputPath string) string { /* iputPath: Gears -> /Gears inputPath: Gears/CbC/hoge.md -> /Gears/CbC/hoge */ outputPATH := inputPath if index := strings.Index(inputPath, "/"); index != 0 { outputPATH = "/" + inputPath } if strings.HasSuffix(outputPATH, ".md") { outputPATH = strings.TrimSuffix(outputPATH, filepath.Ext(outputPATH)) } return outputPATH } func existsFile(conf string) bool { info, err := os.Stat(conf) if os.IsNotExist(err) { return false } return !info.IsDir() }