feat(filex): 自 go-hua/common 迁入文件目录工具并独立成包

- 运行目录定位、路径存在性、带进度回调下载、Zip 打包/解压(兼容 GBK 中文文件名)
- 附单元测试、examples/filex 例程与包 README
This commit is contained in:
2026-09-20 12:20:50 +08:00
parent ca9dedaf82
commit c7e8eb14f8
7 changed files with 463 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package filex
import "os"
// PathExists 判断一个文件或文件夹是否存在
// 输入文件路径,根据返回的bool值来判断文件或文件夹是否存在
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}