feat: file down handle

This commit is contained in:
Noah Hsu
2022-06-28 18:00:11 +08:00
parent d89ec89d51
commit 67bc66fedf
9 changed files with 243 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package utils
import (
stdpath "path"
"path/filepath"
"strings"
)
@ -26,3 +27,11 @@ func StandardizePath(path string) string {
func PathEqual(path1, path2 string) bool {
return StandardizePath(path1) == StandardizePath(path2)
}
func Ext(path string) string {
ext := stdpath.Ext(path)
if strings.HasPrefix(ext, ".") {
return ext[1:]
}
return ext
}