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 return
} }
f.opened = false f.opened = false
$if linux { //$if linux {
//$if linux_or_macos { $if linux_or_macos {
C.syscall(sys_close, f.fd) C.syscall(sys_close, f.fd)
return return
} }

View File

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