示例#1
0
文件: ccpp.go 项目: kien8995/judger
// 创建编译环境的目录结构
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
}
示例#2
0
文件: gather.go 项目: kien8995/judger
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 ""
	}
}
示例#3
0
文件: init.go 项目: kien8995/judger
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
}
示例#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")
}
示例#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")

}
示例#6
0
文件: gather.go 项目: kien8995/judger
// 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
	}
}