瀏覽代碼

Fix issue with `os.file_size` on *nix

Ginger Bill 8 年之前
父節點
當前提交
ded99a2cab
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      core/os_linux.odin
  2. 2 2
      core/os_x.odin

+ 2 - 2
core/os_linux.odin

@@ -179,11 +179,11 @@ seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
 	return res, 0;
 }
 
-file_size :: proc(fd: Handle) -> (i64, bool) {
+file_size :: proc(fd: Handle) -> (i64, Errno) {
 	prev, _ := seek(fd, 0, SEEK_CUR);
 	size, err := seek(fd, 0, SEEK_END);
 	seek(fd, prev, SEEK_SET);
-	return size, err != 0;
+	return size, err;
 }
 
 

+ 2 - 2
core/os_x.odin

@@ -196,11 +196,11 @@ seek :: proc(fd: Handle, offset: AddressSize, whence: int) -> (AddressSize, Errn
 	return final_offset, 0;
 }
 
-file_size :: proc(fd: Handle) -> (i64, bool) {
+file_size :: proc(fd: Handle) -> (i64, Errno) {
 	prev, _ := seek(fd, 0, SEEK_CUR);
 	size, err := seek(fd, 0, SEEK_END);
 	seek(fd, prev, SEEK_SET);
-	return size, err != 0;
+	return size, err;
 }