Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package file
import (
"path/filepath"
"strings"
)
// PathInfo 路径信息
type PathInfo struct {
Dir string // 目录
Ext string // 扩展名
FileName string // 没有扩展名的文件名名称
FullFileName string // 文件全名
}
// GetPathInfo 解析路径
// 返回文件,路径,文件名等信息
func GetPathInfo(path string) (pi PathInfo) {
if path == "" {
return
}
if !filepath.IsAbs(path) {
path, _ = filepath.Abs(path)
}
ext := filepath.Ext(path)
dir, name := filepath.Split(path)
pi.Dir = dir
pi.Ext = ext
pi.FileName = strings.TrimRight(name, ext)
pi.FullFileName = name
return
}