1
0
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:
Alexander Medvednikov 2019-08-17 02:09:36 +03:00
parent 37a607dce5
commit be141d9c5f
2 changed files with 8 additions and 14 deletions

View File

@ -20,17 +20,17 @@ struct dirent {
} }
*/ */
struct C.dirent {
d_name byteptr
}
fn C.readdir(voidptr) C.dirent
const ( const (
args = []string args = []string
MAX_PATH = 4096 MAX_PATH = 4096
) )
// Windows
import const (
FILE_ATTRIBUTE_DIRECTORY
INVALID_FILE_ATTRIBUTES
)
struct C.FILE { struct C.FILE {
} }
@ -418,10 +418,10 @@ pub fn dir_exists(path string) bool {
$if windows { $if windows {
_path := path.replace('/', '\\') _path := path.replace('/', '\\')
attr := int(C.GetFileAttributes(_path.to_wide())) attr := int(C.GetFileAttributes(_path.to_wide()))
if attr == INVALID_FILE_ATTRIBUTES { if attr == C.INVALID_FILE_ATTRIBUTES {
return false return false
} }
if (attr & FILE_ATTRIBUTE_DIRECTORY) != 0 { if (attr & C.FILE_ATTRIBUTE_DIRECTORY) != 0 {
return true return true
} }
return false return false

View File

@ -7,12 +7,6 @@ const (
PathSeparator = '/' PathSeparator = '/'
) )
struct C.dirent {
d_name byteptr
}
fn C.readdir(voidptr) C.dirent
// get_error_msg return error code representation in string. // get_error_msg return error code representation in string.
pub fn get_error_msg(code int) string { pub fn get_error_msg(code int) string {