Add TestDeployStaticFiles()

This commit is contained in:
Gucheng Wang
2022-08-23 21:09:53 +08:00
parent 42864700ec
commit e2921419b9
3 changed files with 117 additions and 0 deletions

View File

@ -16,6 +16,7 @@ package util
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"
@ -43,6 +44,23 @@ func EnsureFileFolderExists(path string) {
}
}
func ListFiles(path string) []string {
res := []string{}
files, err := ioutil.ReadDir(path)
if err != nil {
panic(err)
}
for _, f := range files {
if !f.IsDir() {
res = append(res, f.Name())
}
}
return res
}
func RemoveExt(filename string) string {
return filename[:len(filename)-len(filepath.Ext(filename))]
}