From be141d9c5fd3b67d604a4e67fc8bdafa882d688e Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 17 Aug 2019 02:09:36 +0300 Subject: [PATCH] os: Windows fixes --- vlib/os/os.v | 16 ++++++++-------- vlib/os/os_nix.v | 6 ------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index ff3b409ca7..90ec31e344 100644 --- a/vlib/os/os.v +++ b/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 diff --git a/vlib/os/os_nix.v b/vlib/os/os_nix.v index 52f1cf5853..6eac20da2b 100644 --- a/vlib/os/os_nix.v +++ b/vlib/os/os_nix.v @@ -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 {