aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bun.js/module_loader.zig4
-rw-r--r--src/cli/create_command.zig2
-rw-r--r--src/cli/upgrade_command.zig2
-rw-r--r--src/install/extract_tarball.zig4
-rw-r--r--src/install/install.zig48
-rw-r--r--src/resolver/resolver.zig3
-rw-r--r--src/router.zig4
7 files changed, 33 insertions, 34 deletions
diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig
index 6d834f489..f100fd6e8 100644
--- a/src/bun.js/module_loader.zig
+++ b/src/bun.js/module_loader.zig
@@ -156,11 +156,11 @@ fn dumpSource(specifier: string, printer: anytype) !void {
pub var dir: ?std.fs.Dir = null;
};
if (BunDebugHolder.dir == null) {
- BunDebugHolder.dir = try std.fs.cwd().makeOpenPath("/tmp/bun-debug-src/", .{ .iterate = true });
+ BunDebugHolder.dir = try std.fs.cwd().makeOpenPathIterable("/tmp/bun-debug-src/", .{});
}
if (std.fs.path.dirname(specifier)) |dir_path| {
- var parent = try BunDebugHolder.dir.?.makeOpenPath(dir_path[1..], .{ .iterate = true });
+ var parent = try BunDebugHolder.dir.?.makeOpenPathIterable(dir_path[1..], .{});
defer parent.close();
try parent.writeFile(std.fs.path.basename(specifier), printer.ctx.getWritten());
} else {
diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig
index 8d8d79a8a..c42cf57a7 100644
--- a/src/cli/create_command.zig
+++ b/src/cli/create_command.zig
@@ -573,7 +573,7 @@ pub const CreateCommand = struct {
};
std.fs.deleteTreeAbsolute(destination) catch {};
- const destination_dir = std.fs.cwd().makeOpenPath(destination, .{ .iterate = true }) catch |err| {
+ const destination_dir = std.fs.cwd().makeOpenPathIterable(destination, .{}) catch |err| {
node.end();
progress.refresh();
diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig
index c719a96de..ab9459385 100644
--- a/src/cli/upgrade_command.zig
+++ b/src/cli/upgrade_command.zig
@@ -511,7 +511,7 @@ pub const UpgradeCommand = struct {
const version_name = version.name().?;
var save_dir_ = filesystem.tmpdir();
- var save_dir = save_dir_.makeOpenPath(version_name, .{ .iterate = true }) catch {
+ var save_dir = save_dir_.makeOpenPathIterable(version_name, .{}) catch {
Output.prettyErrorln("<r><red>error:<r> Failed to open temporary directory", .{});
Global.exit(1);
};
diff --git a/src/install/extract_tarball.zig b/src/install/extract_tarball.zig
index 5a790bead..cd927956c 100644
--- a/src/install/extract_tarball.zig
+++ b/src/install/extract_tarball.zig
@@ -158,7 +158,7 @@ fn extract(this: *const ExtractTarball, tgz_bytes: []const u8) !string {
var tmpname = try FileSystem.instance.tmpname(basename[0..@min(basename.len, 32)], &tmpname_buf, tgz_bytes.len);
{
- var extract_destination = tmpdir.makeOpenPath(std.mem.span(tmpname), .{ .iterate = true }) catch |err| {
+ var extract_destination = tmpdir.makeOpenPathIterable(std.mem.span(tmpname), .{}) catch |err| {
Output.panic("err: {s} when create temporary directory named {s} (while extracting {s})", .{ @errorName(err), tmpname, name });
};
@@ -277,7 +277,7 @@ fn extract(this: *const ExtractTarball, tgz_bytes: []const u8) !string {
// create an index storing each version of a package installed
create_index: {
- var index_dir = cache_dir.makeOpenPath(name, .{ .iterate = true }) catch break :create_index;
+ var index_dir = cache_dir.makeOpenPathIterable(name, .{}) catch break :create_index;
defer index_dir.close();
index_dir.symLink(
final_path,
diff --git a/src/install/install.zig b/src/install/install.zig
index 6c5e0a1a4..0f0860463 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -949,7 +949,7 @@ const PackageInstall = struct {
}
};
- var subdir = this.destination_dir.makeOpenPath(std.mem.span(this.destination_dir_subpath), .{ .iterate = true }) catch |err| return Result{
+ var subdir = this.destination_dir.makeOpenPathIterable(std.mem.span(this.destination_dir_subpath), .{}) catch |err| return Result{
.fail = .{ .err = err, .step = .opening_cache_dir },
};
@@ -1069,7 +1069,7 @@ const PackageInstall = struct {
}
};
- var subdir = this.destination_dir.makeOpenPath(std.mem.span(this.destination_dir_subpath), .{ .iterate = true }) catch |err| return Result{
+ var subdir = this.destination_dir.makeOpenPathIterable(std.mem.span(this.destination_dir_subpath), .{}) catch |err| return Result{
.fail = .{ .err = err, .step = .opening_cache_dir },
};
@@ -1126,7 +1126,7 @@ const PackageInstall = struct {
}
};
- var subdir = this.destination_dir.makeOpenPath(std.mem.span(this.destination_dir_subpath), .{ .iterate = true }) catch |err| return Result{
+ var subdir = this.destination_dir.makeOpenPathIterable(std.mem.span(this.destination_dir_subpath), .{}) catch |err| return Result{
.fail = .{ .err = err, .step = .opening_cache_dir },
};
@@ -1221,7 +1221,7 @@ const PackageInstall = struct {
}
};
- var subdir = this.destination_dir.makeOpenPath(std.mem.span(this.destination_dir_subpath), .{ .iterate = true }) catch |err| return Result{
+ var subdir = this.destination_dir.makeOpenPathIterable(std.mem.span(this.destination_dir_subpath), .{}) catch |err| return Result{
.fail = .{ .err = err, .step = .opening_cache_dir },
};
@@ -1655,7 +1655,7 @@ pub const PackageManager = struct {
return this.global_link_dir orelse brk: {
var global_dir = try Options.openGlobalDir(this.options.explicit_global_directory);
this.global_dir = global_dir;
- this.global_link_dir = try global_dir.makeOpenPath("node_modules", .{ .iterate = true });
+ this.global_link_dir = try global_dir.makeOpenPathIterable("node_modules", .{});
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
const _path = try std.os.getFdPath(this.global_link_dir.?.fd, &buf);
this.global_link_dir_path = try Fs.FileSystem.DirnameStore.instance.append([]const u8, _path);
@@ -1765,13 +1765,13 @@ pub const PackageManager = struct {
loop: while (true) {
if (this.options.enable.cache) {
const cache_dir = fetchCacheDirectoryPath(this.env_loader);
- return std.fs.cwd().makeOpenPath(cache_dir.path, .{ .iterate = true }) catch {
+ return std.fs.cwd().makeOpenPathIterable(cache_dir.path, .{}) catch {
this.options.enable.cache = false;
continue :loop;
};
}
- return std.fs.cwd().makeOpenPath("node_modules/.cache", .{ .iterate = true }) catch |err| {
+ return std.fs.cwd().makeOpenPathIterable("node_modules/.cache", .{}) catch |err| {
Output.prettyErrorln("<r><red>error<r>: bun is unable to write files: {s}", .{@errorName(err)});
Global.crash();
};
@@ -1790,9 +1790,9 @@ pub const PackageManager = struct {
// This makes renameat() work
const default_tempdir = Fs.FileSystem.RealFS.getDefaultTempDir();
var tried_dot_tmp = false;
- var tempdir: std.fs.Dir = std.fs.cwd().makeOpenPath(default_tempdir, .{ .iterate = true }) catch brk: {
+ var tempdir: std.fs.Dir = std.fs.cwd().makeOpenPathIterable(default_tempdir, .{}) catch brk: {
tried_dot_tmp = true;
- break :brk cache_directory.makeOpenPath(".tmp", .{ .iterate = true }) catch |err| {
+ break :brk cache_directory.makeOpenPathIterable(".tmp", .{}) catch |err| {
Output.prettyErrorln("<r><red>error<r>: bun is unable to access tempdir: {s}", .{@errorName(err)});
Global.crash();
};
@@ -1805,7 +1805,7 @@ pub const PackageManager = struct {
if (!tried_dot_tmp) {
tried_dot_tmp = true;
- tempdir = cache_directory.makeOpenPath(".tmp", .{ .iterate = true }) catch |err| {
+ tempdir = cache_directory.makeOpenPathIterable(".tmp", .{}) catch |err| {
Output.prettyErrorln("<r><red>error<r>: bun is unable to access tempdir: {s}", .{@errorName(err)});
Global.crash();
};
@@ -1820,7 +1820,7 @@ pub const PackageManager = struct {
std.os.renameatZ(tempdir.fd, tmpname, cache_directory.fd, tmpname) catch |err| {
if (!tried_dot_tmp) {
tried_dot_tmp = true;
- tempdir = cache_directory.makeOpenPath(".tmp", .{ .iterate = true }) catch |err2| {
+ tempdir = cache_directory.makeOpenPathIterable(".tmp", .{}) catch |err2| {
Output.prettyErrorln("<r><red>error<r>: bun is unable to write files to tempdir: {s}", .{@errorName(err2)});
Global.crash();
};
@@ -1978,7 +1978,7 @@ pub const PackageManager = struct {
pub fn getInstalledVersionsFromDiskCache(this: *PackageManager, tags_buf: *std.ArrayList(u8), package_name: []const u8, allocator: std.mem.Allocator) !std.ArrayList(Semver.Version) {
var list = std.ArrayList(Semver.Version).init(allocator);
- var dir = this.getCacheDirectory().openDir(package_name, .{ .iterate = true }) catch |err| {
+ var dir = this.getCacheDirectory().openDir(package_name, .{}) catch |err| {
switch (err) {
error.FileNotFound, error.NotDir, error.AccessDenied, error.DeviceBusy => {
return list;
@@ -3533,25 +3533,25 @@ pub const PackageManager = struct {
pub fn openGlobalDir(explicit_global_dir: string) !std.fs.Dir {
if (std.os.getenvZ("BUN_INSTALL_GLOBAL_DIR")) |home_dir| {
- return try std.fs.cwd().makeOpenPath(home_dir, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(home_dir, .{});
}
if (explicit_global_dir.len > 0) {
- return try std.fs.cwd().makeOpenPath(explicit_global_dir, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(explicit_global_dir, .{});
}
if (std.os.getenvZ("BUN_INSTALL")) |home_dir| {
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
var parts = [_]string{ "install", "global" };
var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto);
- return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(path, .{});
}
if (std.os.getenvZ("XDG_CACHE_HOME") orelse std.os.getenvZ("HOME")) |home_dir| {
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
var parts = [_]string{ ".bun", "install", "global" };
var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto);
- return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(path, .{});
}
return error.@"No global directory found";
@@ -3559,13 +3559,13 @@ pub const PackageManager = struct {
pub fn openGlobalBinDir(opts_: ?*const Api.BunInstall) !std.fs.Dir {
if (std.os.getenvZ("BUN_INSTALL_BIN")) |home_dir| {
- return try std.fs.cwd().makeOpenPath(home_dir, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(home_dir, .{});
}
if (opts_) |opts| {
if (opts.global_bin_dir) |home_dir| {
if (home_dir.len > 0) {
- return try std.fs.cwd().makeOpenPath(home_dir, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(home_dir, .{});
}
}
}
@@ -3576,7 +3576,7 @@ pub const PackageManager = struct {
"bin",
};
var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto);
- return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(path, .{});
}
if (std.os.getenvZ("XDG_CACHE_HOME") orelse std.os.getenvZ("HOME")) |home_dir| {
@@ -3586,7 +3586,7 @@ pub const PackageManager = struct {
"bin",
};
var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto);
- return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true });
+ return try std.fs.cwd().makeOpenPathIterable(path, .{});
}
return error.@"Missing global bin directory: try setting $BUN_INSTALL";
@@ -4546,7 +4546,7 @@ pub const PackageManager = struct {
try manager.setupGlobalDir(&ctx);
- break :brk manager.global_dir.?.makeOpenPath("node_modules", .{ .iterate = true }) catch |err| {
+ break :brk manager.global_dir.?.makeOpenPathIterable("node_modules", .{}) catch |err| {
if (manager.options.log_level != .silent)
Output.prettyErrorln("<r><red>error:<r> failed to create node_modules in global dir due to error {s}", .{@errorName(err)});
Global.crash();
@@ -4709,7 +4709,7 @@ pub const PackageManager = struct {
try manager.setupGlobalDir(&ctx);
- break :brk manager.global_dir.?.makeOpenPath("node_modules", .{ .iterate = true }) catch |err| {
+ break :brk manager.global_dir.?.makeOpenPathIterable("node_modules", .{}) catch |err| {
if (manager.options.log_level != .silent)
Output.prettyErrorln("<r><red>error:<r> failed to create node_modules in global dir due to error {s}", .{@errorName(err)});
Global.crash();
@@ -5910,13 +5910,13 @@ pub const PackageManager = struct {
// we want to check lazily though
// no need to download packages you've already installed!!
var skip_verify_installed_version_number = false;
- var node_modules_folder = std.fs.cwd().openDirZ("node_modules", .{ .iterate = true }) catch brk: {
+ var node_modules_folder = std.fs.cwd().openDirZ("node_modules", .{}) catch brk: {
skip_verify_installed_version_number = true;
std.fs.cwd().makeDirZ("node_modules") catch |err| {
Output.prettyErrorln("<r><red>error<r>: <b><red>{s}<r> creating <b>node_modules<r> folder", .{@errorName(err)});
Global.crash();
};
- break :brk std.fs.cwd().openDirZ("node_modules", .{ .iterate = true }) catch |err| {
+ break :brk std.fs.cwd().openDirZ("node_modules", .{}) catch |err| {
Output.prettyErrorln("<r><red>error<r>: <b><red>{s}<r> opening <b>node_modules<r> folder", .{@errorName(err)});
Global.crash();
};
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 9fad998cb..e5c873160 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -2248,10 +2248,9 @@ pub const Resolver = struct {
path.ptr[queue_top.unsafe_path.len] = 0;
defer path.ptr[queue_top.unsafe_path.len] = prev_char;
var sentinel = path.ptr[0..queue_top.unsafe_path.len :0];
- _open_dir = std.fs.openDirAbsoluteZ(
+ _open_dir = std.fs.openIterableDirAbsoluteZ(
sentinel,
.{
- .iterate = true,
.no_follow = !follow_symlinks,
},
);
diff --git a/src/router.zig b/src/router.zig
index cb39fa079..21d6deaa3 100644
--- a/src/router.zig
+++ b/src/router.zig
@@ -880,10 +880,10 @@ pub const MockServer = struct {
fn makeTest(cwd_path: string, data: anytype) !void {
Output.initTest();
std.debug.assert(cwd_path.len > 1 and !strings.eql(cwd_path, "/") and !strings.endsWith(cwd_path, "bun"));
- const bun_tests_dir = try std.fs.cwd().makeOpenPath("bun-test-scratch", .{ .iterate = true });
+ const bun_tests_dir = try std.fs.cwd().makeOpenPathIterable("bun-test-scratch", .{});
bun_tests_dir.deleteTree(cwd_path) catch {};
- const cwd = try bun_tests_dir.makeOpenPath(cwd_path, .{ .iterate = true });
+ const cwd = try bun_tests_dir.makeOpenPathIterable(cwd_path, .{});
try cwd.setAsCwd();
const Data = @TypeOf(data);