From d226fa7b17f8d0e6a3c6f9792e0c6f8e8e38006c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 1 Jan 2020 12:10:39 +0100 Subject: [PATCH] enable macos syscalls --- vlib/os/os.v | 4 ++-- vlib/os/os_nix.v | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 739983c06a..a3e058e994 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -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 } diff --git a/vlib/os/os_nix.v b/vlib/os/os_nix.v index 6b4ae7aab3..4583af71fb 100644 --- a/vlib/os/os_nix.v +++ b/vlib/os/os_nix.v @@ -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