增加获取文件扩展名的方法

This commit is contained in:
白茶清欢 2024-06-18 11:54:51 +08:00
parent 1f58204e86
commit 8d48a6bd39
3 changed files with 15 additions and 2 deletions

View File

@ -284,3 +284,12 @@ func (f *file) ReadDirFileList(dirPath string, ignoreHiddenFile bool, isRecurve
func (f *file) ReadFileListRecurve(rootDir string) ([]*define.FileInfo, error) { func (f *file) ReadFileListRecurve(rootDir string) ([]*define.FileInfo, error) {
return nil, nil return nil, nil
} }
// FileExt 获取文件后缀
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 11:53 2024/6/18
func (f *file) FileExt(filePath string) string {
return strings.TrimLeft(filepath.Ext(filePath), ".")
}

4
go.mod
View File

@ -6,9 +6,9 @@ toolchain go1.21.4
require ( require (
git.zhangdeman.cn/zhangdeman/util v0.0.0-20231227095334-7eb5cdbf9253 git.zhangdeman.cn/zhangdeman/util v0.0.0-20231227095334-7eb5cdbf9253
github.com/BurntSushi/toml v1.3.2 github.com/BurntSushi/toml v1.4.0
github.com/go-ini/ini v1.67.0 github.com/go-ini/ini v1.67.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240104123641-b3f23974e5d6 require git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240617073616-39e82fd033ed

4
go.sum
View File

@ -4,6 +4,8 @@ git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230815040024-2b12dd51d19b h1:C7Kftn
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230815040024-2b12dd51d19b/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20230815040024-2b12dd51d19b/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240104123641-b3f23974e5d6 h1:ytpXTP3oxp480BAZQoOzqlBP4XP73NcpMplZ1/fA1lQ= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240104123641-b3f23974e5d6 h1:ytpXTP3oxp480BAZQoOzqlBP4XP73NcpMplZ1/fA1lQ=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240104123641-b3f23974e5d6/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k= git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240104123641-b3f23974e5d6/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240617073616-39e82fd033ed h1:BGv+y6ZdtkxI4HeSIHun0QRrIzjLnUht0bKdyO2t6n4=
git.zhangdeman.cn/zhangdeman/consts v0.0.0-20240617073616-39e82fd033ed/go.mod h1:IXXaZkb7vGzGnGM5RRWrASAuwrVSNxuoe0DmeXx5g6k=
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4 h1:MgZ2f1BkUtfP8D6uDX9S8o+V4wYUw76HlAw3xCH9epA= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4 h1:MgZ2f1BkUtfP8D6uDX9S8o+V4wYUw76HlAw3xCH9epA=
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4/go.mod h1:tPl6isAsRQLZrX8G3/8fCdhN4OcZypdmdHR/PDkd2PY= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810093304-ccb4045065c4/go.mod h1:tPl6isAsRQLZrX8G3/8fCdhN4OcZypdmdHR/PDkd2PY=
git.zhangdeman.cn/zhangdeman/util v0.0.0-20230815042559-b34984be7444 h1:JVp575weLUX4sfhgjjxotJPxfHio7Ua8KHH3LMRRs2E= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230815042559-b34984be7444 h1:JVp575weLUX4sfhgjjxotJPxfHio7Ua8KHH3LMRRs2E=
@ -14,6 +16,8 @@ git.zhangdeman.cn/zhangdeman/util v0.0.0-20231227095334-7eb5cdbf9253 h1:GO3oZa5a
git.zhangdeman.cn/zhangdeman/util v0.0.0-20231227095334-7eb5cdbf9253/go.mod h1:VpPjBlwz8U+OxZuxzHQBv1aEEZ3pStH6bZvT21ADEbI= git.zhangdeman.cn/zhangdeman/util v0.0.0-20231227095334-7eb5cdbf9253/go.mod h1:VpPjBlwz8U+OxZuxzHQBv1aEEZ3pStH6bZvT21ADEbI=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=