aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Cache/Path.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-03 20:37:43 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:07 -0800
commitd1d2c37af26902f953b2b72335b326c4b01e3bb2 (patch)
treeff74335c6b9eda252c6c4970d49f36bd6f904537 /lib/std/Build/Cache/Path.zig
parent81214278ca14b832e53876feb70fa3c072c14dd6 (diff)
downloadzig-d1d2c37af26902f953b2b72335b326c4b01e3bb2.tar.gz
zig-d1d2c37af26902f953b2b72335b326c4b01e3bb2.zip
std: all Dir functions moved to std.Io
Diffstat (limited to 'lib/std/Build/Cache/Path.zig')
-rw-r--r--lib/std/Build/Cache/Path.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/std/Build/Cache/Path.zig b/lib/std/Build/Cache/Path.zig
index 92290cfdf4..f6f76c1e8f 100644
--- a/lib/std/Build/Cache/Path.zig
+++ b/lib/std/Build/Cache/Path.zig
@@ -2,8 +2,8 @@ const Path = @This();
const std = @import("../../std.zig");
const Io = std.Io;
-const assert = std.debug.assert;
const fs = std.fs;
+const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const Cache = std.Build.Cache;
@@ -62,8 +62,8 @@ pub fn joinStringZ(p: Path, gpa: Allocator, sub_path: []const u8) Allocator.Erro
pub fn openFile(
p: Path,
sub_path: []const u8,
- flags: fs.File.OpenFlags,
-) !fs.File {
+ flags: Io.File.OpenFlags,
+) !Io.File {
var buf: [fs.max_path_bytes]u8 = undefined;
const joined_path = if (p.sub_path.len == 0) sub_path else p: {
break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
@@ -76,8 +76,8 @@ pub fn openFile(
pub fn openDir(
p: Path,
sub_path: []const u8,
- args: fs.Dir.OpenOptions,
-) fs.Dir.OpenError!fs.Dir {
+ args: Io.Dir.OpenOptions,
+) Io.Dir.OpenError!Io.Dir {
var buf: [fs.max_path_bytes]u8 = undefined;
const joined_path = if (p.sub_path.len == 0) sub_path else p: {
break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
@@ -87,7 +87,7 @@ pub fn openDir(
return p.root_dir.handle.openDir(joined_path, args);
}
-pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.Dir.OpenOptions) !fs.Dir {
+pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: Io.Dir.OpenOptions) !Io.Dir {
var buf: [fs.max_path_bytes]u8 = undefined;
const joined_path = if (p.sub_path.len == 0) sub_path else p: {
break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
@@ -97,7 +97,7 @@ pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.Dir.OpenOptions) !fs
return p.root_dir.handle.makeOpenPath(joined_path, opts);
}
-pub fn statFile(p: Path, sub_path: []const u8) !fs.Dir.Stat {
+pub fn statFile(p: Path, sub_path: []const u8) !Io.Dir.Stat {
var buf: [fs.max_path_bytes]u8 = undefined;
const joined_path = if (p.sub_path.len == 0) sub_path else p: {
break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
@@ -110,7 +110,7 @@ pub fn statFile(p: Path, sub_path: []const u8) !fs.Dir.Stat {
pub fn atomicFile(
p: Path,
sub_path: []const u8,
- options: fs.Dir.AtomicFileOptions,
+ options: Io.Dir.AtomicFileOptions,
buf: *[fs.max_path_bytes]u8,
) !fs.AtomicFile {
const joined_path = if (p.sub_path.len == 0) sub_path else p: {
@@ -180,7 +180,7 @@ pub fn formatEscapeChar(path: Path, writer: *Io.Writer) Io.Writer.Error!void {
}
pub fn format(self: Path, writer: *Io.Writer) Io.Writer.Error!void {
- if (std.fs.path.isAbsolute(self.sub_path)) {
+ if (fs.path.isAbsolute(self.sub_path)) {
try writer.writeAll(self.sub_path);
return;
}
@@ -225,9 +225,9 @@ pub const TableAdapter = struct {
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
_ = self;
- const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
- .pointer => @intFromPtr(a.root_dir.handle.fd),
- .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
+ const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.handle))) {
+ .pointer => @intFromPtr(a.root_dir.handle.handle),
+ .int => @as(u32, @bitCast(a.root_dir.handle.handle)),
else => @compileError("unimplemented hash function"),
};
return @truncate(Hash.hash(seed, a.sub_path));