aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/node/node_fs_constant.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-20 23:46:11 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-20 23:46:11 -0700
commit5e739acfbbf10dea455e8bf97cd420116fa8ae45 (patch)
tree89d75e25ab4947327049894341f4fa6a3a15b9b7 /src/javascript/jsc/node/node_fs_constant.zig
parenta4b8fccfa70507c80cc5666cc14c9c37ac201a15 (diff)
downloadbun-5e739acfbbf10dea455e8bf97cd420116fa8ae45.tar.gz
bun-5e739acfbbf10dea455e8bf97cd420116fa8ae45.tar.zst
bun-5e739acfbbf10dea455e8bf97cd420116fa8ae45.zip
[misc] Fix broken build on macOS
Diffstat (limited to 'src/javascript/jsc/node/node_fs_constant.zig')
-rw-r--r--src/javascript/jsc/node/node_fs_constant.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/javascript/jsc/node/node_fs_constant.zig b/src/javascript/jsc/node/node_fs_constant.zig
index 23523df91..655c18a4c 100644
--- a/src/javascript/jsc/node/node_fs_constant.zig
+++ b/src/javascript/jsc/node/node_fs_constant.zig
@@ -2,6 +2,12 @@ const bun = @import("../../../global.zig");
const Environment = bun.Environment;
const std = @import("std");
+fn get(comptime name: []const u8) comptime_int {
+ return if (@hasDecl(std.os.O, name))
+ return @field(std.os.O, name)
+ else
+ return 0;
+}
pub const Constants = struct {
// File Access Constants
/// Constant for fs.access(). File is visible to the calling process.
@@ -74,7 +80,7 @@ pub const Constants = struct {
/// Flag indicating reading accesses to the file system will no longer result in
/// an update to the atime information associated with the file.
/// This flag is available on Linux operating systems only.
- pub const O_NOATIME = std.os.O.NOATIME;
+ pub const O_NOATIME = get("NOATIME");
/// Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link.
pub const O_NOFOLLOW = std.os.O.NOFOLLOW;
/// Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O.
@@ -82,9 +88,9 @@ pub const Constants = struct {
/// Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity.
pub const O_DSYNC = std.os.O.DSYNC;
/// Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to.
- pub const O_SYMLINK = if (Environment.isMac) std.os.O.O_SYMLINK;
+ pub const O_SYMLINK = get("SYMLINK");
/// Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O.
- pub const O_DIRECT = std.os.O.DIRECT;
+ pub const O_DIRECT = get("DIRECT");
/// Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible.
pub const O_NONBLOCK = std.os.O.NONBLOCK;
// File Type Constants