// 创建编译环境的目录结构 func (this *Compile) createDirs(id int, sid string) error { var err error err = nil this.userBuildPath = filepath.Join(this.buildPath, sid) if !com.PathExist(this.userBuildPath) { err = com.Mkdir(this.userBuildPath) } this.itemBuildPath = filepath.Join(this.userBuildPath, fmt.Sprintf("%d", id)) if !com.PathExist(this.itemBuildPath) { err = com.Mkdir(this.itemBuildPath) } return err }
func (this *Info) getLog(file string) string { path := filepath.Join(this.buildPath, this.sid, fmt.Sprintf("%d", this.id), file) if com.PathExist(path) { return com.ReadFile(path) } else { return "" } }
func createBuildDir() error { var err error err = nil buildPath := filepath.Join(C.Get(runtime.GOOS, "buildpath")) if !com.PathExist(buildPath) { err = com.Mkdir(buildPath) } return err }
func (this *SiteIconController) Get() { localfile := "fis/img/favicon.ico" if !com.PathExist(localfile) { utils.GetImage(beego.AppConfig.String("logo"), localfile) } data, _ := utils.ReadFileByte(localfile) this.Ctx.Output.Body(data) this.Ctx.Output.ContentType("image/x-icon") }
func (this *LogoController) Get() { localfile := "tmp/logo.png" if !com.PathExist(localfile) { utils.GetImage(beego.AppConfig.String("logo"), localfile) } data, _ := utils.ReadFileByte(localfile) this.Ctx.Output.Body(data) this.Ctx.Output.ContentType("image/png") }
// get the result func (this *Info) getResult(file string) int { path := filepath.Join(this.buildPath, this.sid, fmt.Sprintf("%d", this.id), file) if com.PathExist(path) { content := com.ReadFile(path) content = com.Strim(content) if result, err := strconv.Atoi(content); err != nil { log.Warnln(err) return -1 } else { return result } } else { return -1 } }