authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2023-04-20 13:21:51+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-04-20 15:47:39-07:00
logb7c00999be95a72f39c040b9e2a43ccc6100d0a8
tree99d4aaaf163e8f48e3f6c9c8a314686219e10407
parent304e4082a0a50c2a6dfbba2a1985cf772edb9e73

std.fs: add linking docs to makeDir*

Docs that link back to the other similar functions.

1 files changed, 14 insertions(+), 5 deletions(-)

lib/std/fs.zig+14-5
...@@ -244,13 +244,13 @@ pub fn makeDirAbsolute(absolute_path: []const u8) !void {...@@ -244,13 +244,13 @@ pub fn makeDirAbsolute(absolute_path: []const u8) !void {
244 return os.mkdir(absolute_path, default_new_dir_mode);244 return os.mkdir(absolute_path, default_new_dir_mode);
245}245}
246246
247/// Same as `makeDirAbsolute` except the parameter is a null-terminated UTF8-encoded string.247/// Same as `makeDirAbsolute` except the parameter is a null-terminated UTF-8-encoded string.
248pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void {248pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void {
249 assert(path.isAbsoluteZ(absolute_path_z));249 assert(path.isAbsoluteZ(absolute_path_z));
250 return os.mkdirZ(absolute_path_z, default_new_dir_mode);250 return os.mkdirZ(absolute_path_z, default_new_dir_mode);
251}251}
252252
253/// Same as `makeDirAbsolute` except the parameter is a null-terminated WTF-16 encoded string.253/// Same as `makeDirAbsolute` except the parameter is a null-terminated WTF-16-encoded string.
254pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void {254pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void {
255 assert(path.isAbsoluteWindowsW(absolute_path_w));255 assert(path.isAbsoluteWindowsW(absolute_path_w));
256 return os.mkdirW(absolute_path_w, default_new_dir_mode);256 return os.mkdirW(absolute_path_w, default_new_dir_mode);
...@@ -1419,14 +1419,23 @@ pub const Dir = struct {...@@ -1419,14 +1419,23 @@ pub const Dir = struct {
1419 return file;1419 return file;
1420 }1420 }
14211421
1422 /// Creates a single directory with a relative or absolute path.
1423 /// To create multiple directories to make an entire path, see `makePath`.
1424 /// To operate on only absolute paths, see `makeDirAbsolute`.
1422 pub fn makeDir(self: Dir, sub_path: []const u8) !void {1425 pub fn makeDir(self: Dir, sub_path: []const u8) !void {
1423 try os.mkdirat(self.fd, sub_path, default_new_dir_mode);1426 try os.mkdirat(self.fd, sub_path, default_new_dir_mode);
1424 }1427 }
14251428
1429 /// Creates a single directory with a relative or absolute null-terminated UTF-8-encoded path.
1430 /// To create multiple directories to make an entire path, see `makePath`.
1431 /// To operate on only absolute paths, see `makeDirAbsoluteZ`.
1426 pub fn makeDirZ(self: Dir, sub_path: [*:0]const u8) !void {1432 pub fn makeDirZ(self: Dir, sub_path: [*:0]const u8) !void {
1427 try os.mkdiratZ(self.fd, sub_path, default_new_dir_mode);1433 try os.mkdiratZ(self.fd, sub_path, default_new_dir_mode);
1428 }1434 }
14291435
1436 /// Creates a single directory with a relative or absolute null-terminated WTF-16-encoded path.
1437 /// To create multiple directories to make an entire path, see `makePath`.
1438 /// To operate on only absolute paths, see `makeDirAbsoluteW`.
1430 pub fn makeDirW(self: Dir, sub_path: [*:0]const u16) !void {1439 pub fn makeDirW(self: Dir, sub_path: [*:0]const u16) !void {
1431 try os.mkdiratW(self.fd, sub_path, default_new_dir_mode);1440 try os.mkdiratW(self.fd, sub_path, default_new_dir_mode);
1432 }1441 }
...@@ -2463,7 +2472,7 @@ pub const Dir = struct {...@@ -2463,7 +2472,7 @@ pub const Dir = struct {
2463 pub const AccessError = os.AccessError;2472 pub const AccessError = os.AccessError;
24642473
2465 /// Test accessing `path`.2474 /// Test accessing `path`.
2466 /// `path` is UTF8-encoded.2475 /// `path` is UTF-8-encoded.
2467 /// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.2476 /// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.
2468 /// For example, instead of testing if a file exists and then opening it, just2477 /// For example, instead of testing if a file exists and then opening it, just
2469 /// open it and handle the error for file not found.2478 /// open it and handle the error for file not found.
...@@ -2736,14 +2745,14 @@ pub fn openFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.OpenFlags)...@@ -2736,14 +2745,14 @@ pub fn openFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.OpenFlags)
2736 return cwd().openFileZ(absolute_path_c, flags);2745 return cwd().openFileZ(absolute_path_c, flags);
2737}2746}
27382747
2739/// Same as `openFileAbsolute` but the path parameter is WTF-16 encoded.2748/// Same as `openFileAbsolute` but the path parameter is WTF-16-encoded.
2740pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File {2749pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File {
2741 assert(path.isAbsoluteWindowsWTF16(absolute_path_w));2750 assert(path.isAbsoluteWindowsWTF16(absolute_path_w));
2742 return cwd().openFileW(absolute_path_w, flags);2751 return cwd().openFileW(absolute_path_w, flags);
2743}2752}
27442753
2745/// Test accessing `path`.2754/// Test accessing `path`.
2746/// `path` is UTF8-encoded.2755/// `path` is UTF-8-encoded.
2747/// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.2756/// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.
2748/// For example, instead of testing if a file exists and then opening it, just2757/// For example, instead of testing if a file exists and then opening it, just
2749/// open it and handle the error for file not found.2758/// open it and handle the error for file not found.