os: Windows fixes

pull/1625/head
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 (
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

View File

@ -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 {