mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: Windows fixes
This commit is contained in:
parent
37a607dce5
commit
be141d9c5f
16
vlib/os/os.v
16
vlib/os/os.v
@ -20,17 +20,17 @@ struct dirent {
|
||||
}
|
||||
*/
|
||||
|
||||
struct C.dirent {
|
||||
d_name byteptr
|
||||
}
|
||||
|
||||
fn C.readdir(voidptr) C.dirent
|
||||
|
||||
const (
|
||||
args = []string
|
||||
MAX_PATH = 4096
|
||||
)
|
||||
|
||||
// Windows
|
||||
import const (
|
||||
FILE_ATTRIBUTE_DIRECTORY
|
||||
INVALID_FILE_ATTRIBUTES
|
||||
)
|
||||
|
||||
struct C.FILE {
|
||||
|
||||
}
|
||||
@ -418,10 +418,10 @@ pub fn dir_exists(path string) bool {
|
||||
$if windows {
|
||||
_path := path.replace('/', '\\')
|
||||
attr := int(C.GetFileAttributes(_path.to_wide()))
|
||||
if attr == INVALID_FILE_ATTRIBUTES {
|
||||
if attr == C.INVALID_FILE_ATTRIBUTES {
|
||||
return false
|
||||
}
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY) != 0 {
|
||||
if (attr & C.FILE_ATTRIBUTE_DIRECTORY) != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
@ -7,12 +7,6 @@ const (
|
||||
PathSeparator = '/'
|
||||
)
|
||||
|
||||
struct C.dirent {
|
||||
d_name byteptr
|
||||
}
|
||||
|
||||
fn C.readdir(voidptr) C.dirent
|
||||
|
||||
|
||||
// get_error_msg return error code representation in string.
|
||||
pub fn get_error_msg(code int) string {
|
||||
|
Loading…
Reference in New Issue
Block a user