123456789101112131415161718192021222324252627282930313233 |
- //go:build windows
- package yu_path
- import (
- yu_win "gogs.qqck.cn/s/tools/win"
- )
- // IsFile
- //
- // @Description: 判断给定路径是否是文件类型
- func IsFile(s string) bool {
- j_type := GetFileAttributes(s)
- if j_type == -1 {
- return false
- }
- return j_type&yu_win.FILE_ATTRIBUTE_DIRECTORY == 0
- }
- // IsDir
- //
- // @Description: 判断给定路径是否是目录类型
- func IsDir(s string) bool {
- j_type := GetFileAttributes(s)
- if j_type == -1 {
- return false
- }
- return j_type&yu_win.FILE_ATTRIBUTE_DIRECTORY == yu_win.FILE_ATTRIBUTE_DIRECTORY
- }
- func GetFileAttributes(s string) int32 {
- return yu_win.GetFileAttributesW.CallInt32(yu_win.S{yu_win.Unicode, s})
- }
|