enable macos syscalls

pull/3293/head
Alexander Medvednikov 2020-01-01 12:10:39 +01:00
parent 2f8969c604
commit d226fa7b17
2 changed files with 10 additions and 10 deletions

View File

@ -329,8 +329,8 @@ pub fn (f mut File) close() {
return
}
f.opened = false
$if linux {
//$if linux_or_macos {
//$if linux {
$if linux_or_macos {
C.syscall(sys_close, f.fd)
return
}

View File

@ -68,8 +68,8 @@ pub fn is_dir(path string) bool {
*/
pub fn open(path string) ?File {
$if linux {
//$if linux_or_macos {
//$if linux {
$if linux_or_macos {
fd := C.syscall(sys_open, path.str, 511)
if fd == -1 {
return error('failed to open file "$path"')
@ -95,8 +95,8 @@ pub fn open(path string) ?File {
// create creates a file at a specified location and returns a writable `File` object.
pub fn create(path string) ?File {
$if linux {
//$if linux_or_macos {
//$if linux {
$if linux_or_macos {
mut fd := 0
//println('creat SYS')
$if macos {
@ -134,8 +134,8 @@ pub fn (f mut File) write(s string) {
if !f.opened {
return
}
$if linux {
//$if linux_or_macos {
//$if linux {
$if linux_or_macos {
C.syscall(sys_write, f.fd, s.str, s.len)
return
}
@ -148,8 +148,8 @@ pub fn (f mut File) writeln(s string) {
if !f.opened {
return
}
//$if linux_or_macos {
$if linux {
$if linux_or_macos {
//$if linux {
snl := s + '\n'
C.syscall(sys_write, f.fd, snl.str, snl.len)
return