mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: fix is_dir
This commit is contained in:
parent
68b46bb943
commit
fa24a0cec5
@ -80,6 +80,12 @@ const (
|
|||||||
O_TRUNC = 128 // truncate regular writable file when opened.
|
O_TRUNC = 128 // truncate regular writable file when opened.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ref: http://www.ccfit.nsu.ru/~deviv/courses/unix/unix/ng7c229.html
|
||||||
|
const (
|
||||||
|
S_IFMT = 0xF000 // type of file
|
||||||
|
S_IFDIR = 0x4000 // directory
|
||||||
|
)
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
const(
|
const(
|
||||||
INVALID_HANDLE_VALUE = -1
|
INVALID_HANDLE_VALUE = -1
|
||||||
|
@ -718,7 +718,8 @@ pub fn is_dir(path string) bool {
|
|||||||
if C.stat(cstr, &statbuf) != 0 {
|
if C.stat(cstr, &statbuf) != 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return statbuf.st_mode & S_IFMT == S_IFDIR
|
// ref: https://code.woboq.org/gcc/include/sys/stat.h.html
|
||||||
|
return (statbuf.st_mode & S_IFMT) == S_IFDIR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user