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 {
244244 return os.mkdir(absolute_path, default_new_dir_mode);
245245}
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.
248248pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void {
249249 assert(path.isAbsoluteZ(absolute_path_z));
250250 return os.mkdirZ(absolute_path_z, default_new_dir_mode);
251251}
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.
254254pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void {
255255 assert(path.isAbsoluteWindowsW(absolute_path_w));
256256 return os.mkdirW(absolute_path_w, default_new_dir_mode);
......@@ -1419,14 +1419,23 @@ pub const Dir = struct {
14191419 return file;
14201420 }
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`.
14221425 pub fn makeDir(self: Dir, sub_path: []const u8) !void {
14231426 try os.mkdirat(self.fd, sub_path, default_new_dir_mode);
14241427 }
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`.
14261432 pub fn makeDirZ(self: Dir, sub_path: [*:0]const u8) !void {
14271433 try os.mkdiratZ(self.fd, sub_path, default_new_dir_mode);
14281434 }
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`.
14301439 pub fn makeDirW(self: Dir, sub_path: [*:0]const u16) !void {
14311440 try os.mkdiratW(self.fd, sub_path, default_new_dir_mode);
14321441 }
......@@ -2463,7 +2472,7 @@ pub const Dir = struct {
24632472 pub const AccessError = os.AccessError;
24642473
24652474 /// Test accessing `path`.
2466 /// `path` is UTF8-encoded.
2475 /// `path` is UTF-8-encoded.
24672476 /// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.
24682477 /// For example, instead of testing if a file exists and then opening it, just
24692478 /// 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)
27362745 return cwd().openFileZ(absolute_path_c, flags);
27372746}
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.
27402749pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File {
27412750 assert(path.isAbsoluteWindowsWTF16(absolute_path_w));
27422751 return cwd().openFileW(absolute_path_w, flags);
27432752}
27442753
27452754/// Test accessing `path`.
2746/// `path` is UTF8-encoded.
2755/// `path` is UTF-8-encoded.
27472756/// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.
27482757/// For example, instead of testing if a file exists and then opening it, just
27492758/// open it and handle the error for file not found.