mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
Add TestDeployStaticFiles()
This commit is contained in:
18
util/path.go
18
util/path.go
@ -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))]
|
||||
}
|
||||
|
Reference in New Issue
Block a user