Exemplo n.º 1
0
// 创建编译环境的目录结构
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
}
Exemplo n.º 2
0
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 ""
	}
}
Exemplo n.º 3
0
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
}
Exemplo n.º 4
0
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")
}
Exemplo n.º 5
0
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")

}
Exemplo n.º 6
0
// 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
	}
}