| ... | @@ -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 | } |
| 246 | | 246 | |
| 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. |
| 248 | pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void { | 248 | pub 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 | } |
| 252 | | 252 | |
| 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. |
| 254 | pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void { | 254 | pub 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 | } |
| 1421 | | 1421 | |
| | 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 | } |
| 1425 | | 1428 | |
| | 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 | } |
| 1429 | | 1435 | |
| | 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; |
| 2464 | | 2473 | |
| 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, just | 2477 | /// 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 | } |
| 2738 | | 2747 | |
| 2739 | /// Same as `openFileAbsolute` but the path parameter is WTF-16 encoded. | 2748 | /// Same as `openFileAbsolute` but the path parameter is WTF-16-encoded. |
| 2740 | pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File { | 2749 | pub 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 | } |
| 2744 | | 2753 | |
| 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, just | 2757 | /// 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. |