os: replace FILE with voidptr to remove stdlib.h dep
parent
67f68df8a8
commit
883041fbcc
10
vlib/os/os.v
10
vlib/os/os.v
|
@ -31,12 +31,14 @@ pub const (
|
||||||
MAX_PATH = 4096
|
MAX_PATH = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
struct C.FILE {
|
struct C.FILE {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
pub struct File {
|
pub struct File {
|
||||||
cfile &FILE
|
cfile voidptr
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FileInfo {
|
struct FileInfo {
|
||||||
|
@ -149,7 +151,7 @@ pub fn cp(old, new string) ?bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vfopen(path, mode string) *C.FILE {
|
fn vfopen(path, mode string) voidptr { //*C.FILE {
|
||||||
$if windows {
|
$if windows {
|
||||||
return C._wfopen(path.to_wide(), mode.to_wide())
|
return C._wfopen(path.to_wide(), mode.to_wide())
|
||||||
} $else {
|
} $else {
|
||||||
|
@ -305,7 +307,7 @@ pub fn (f File) close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// system starts the specified command, waits for it to complete, and returns its code.
|
// system starts the specified command, waits for it to complete, and returns its code.
|
||||||
fn vpopen(path string) *C.FILE {
|
fn vpopen(path string) voidptr {//*C.FILE {
|
||||||
$if windows {
|
$if windows {
|
||||||
mode := 'rb'
|
mode := 'rb'
|
||||||
wpath := path.to_wide()
|
wpath := path.to_wide()
|
||||||
|
@ -336,7 +338,7 @@ fn posix_wait4_to_exit_status(waitret int) (int,bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vpclose(f *C.FILE) int {
|
fn vpclose(f voidptr) int {
|
||||||
$if windows {
|
$if windows {
|
||||||
return int( C._pclose(f) )
|
return int( C._pclose(f) )
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue