package util import "os" //import "github.com/EDDYCJY/go-gin-example/pkg/setting" const EXT = ".xlsx" // GetExcelFullUrl get the full access path of the Excel file func GetExcelFullUrl(name string) string { return "." + "/" + name } // GetExcelPath get the relative save path of the Excel file func GetExcelPath() string { //return setting.AppSetting.ExportSavePath return "excel/" } // GetExcelFullPath Get the full save path of the Excel file func GetExcelFullPath() string { return "./" + GetExcelPath() } // IsNotExistMkDir create a directory if it does not exist func IsNotExistMkDir(src string) error { if notExist := CheckNotExist(src); notExist == true { if err := MkDir(src); err != nil { return err } } return nil } // CheckNotExist check if the file exists func CheckNotExist(src string) bool { _, err := os.Stat(src) return os.IsNotExist(err) } // MkDir create a directory func MkDir(src string) error { err := os.MkdirAll(src, os.ModePerm) if err != nil { return err } return nil }