| ... | @@ -138,12 +138,6 @@ pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void { | ... | @@ -138,12 +138,6 @@ pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void { |
| 138 | | 138 | |
| 139 | test makeDirAbsoluteZ {} | 139 | test makeDirAbsoluteZ {} |
| 140 | | 140 | |
| 141 | /// Same as `makeDirAbsolute` except the parameter is a null-terminated WTF-16 LE-encoded string. | | |
| 142 | pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void { | | |
| 143 | assert(path.isAbsoluteWindowsW(absolute_path_w)); | | |
| 144 | return posix.mkdirW(mem.span(absolute_path_w), Dir.default_mode); | | |
| 145 | } | | |
| 146 | | | |
| 147 | /// Same as `Dir.deleteDir` except the path is absolute. | 141 | /// Same as `Dir.deleteDir` except the path is absolute. |
| 148 | /// On Windows, `dir_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/). | 142 | /// On Windows, `dir_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 149 | /// On WASI, `dir_path` should be encoded as valid UTF-8. | 143 | /// On WASI, `dir_path` should be encoded as valid UTF-8. |
| ... | @@ -159,12 +153,6 @@ pub fn deleteDirAbsoluteZ(dir_path: [*:0]const u8) !void { | ... | @@ -159,12 +153,6 @@ pub fn deleteDirAbsoluteZ(dir_path: [*:0]const u8) !void { |
| 159 | return posix.rmdirZ(dir_path); | 153 | return posix.rmdirZ(dir_path); |
| 160 | } | 154 | } |
| 161 | | 155 | |
| 162 | /// Same as `deleteDirAbsolute` except the path parameter is WTF-16 and target OS is assumed Windows. | | |
| 163 | pub fn deleteDirAbsoluteW(dir_path: [*:0]const u16) !void { | | |
| 164 | assert(path.isAbsoluteWindowsW(dir_path)); | | |
| 165 | return posix.rmdirW(mem.span(dir_path)); | | |
| 166 | } | | |
| 167 | | | |
| 168 | /// Same as `Dir.rename` except the paths are absolute. | 156 | /// Same as `Dir.rename` except the paths are absolute. |
| 169 | /// On Windows, both paths should be encoded as [WTF-8](https://wtf-8.codeberg.page/). | 157 | /// On Windows, both paths should be encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 170 | /// On WASI, both paths should be encoded as valid UTF-8. | 158 | /// On WASI, both paths should be encoded as valid UTF-8. |
| ... | @@ -182,13 +170,6 @@ pub fn renameAbsoluteZ(old_path: [*:0]const u8, new_path: [*:0]const u8) !void { | ... | @@ -182,13 +170,6 @@ pub fn renameAbsoluteZ(old_path: [*:0]const u8, new_path: [*:0]const u8) !void { |
| 182 | return posix.renameZ(old_path, new_path); | 170 | return posix.renameZ(old_path, new_path); |
| 183 | } | 171 | } |
| 184 | | 172 | |
| 185 | /// Same as `renameAbsolute` except the path parameters are WTF-16 and target OS is assumed Windows. | | |
| 186 | pub fn renameAbsoluteW(old_path: [*:0]const u16, new_path: [*:0]const u16) !void { | | |
| 187 | assert(path.isAbsoluteWindowsW(old_path)); | | |
| 188 | assert(path.isAbsoluteWindowsW(new_path)); | | |
| 189 | return posix.renameW(old_path, new_path); | | |
| 190 | } | | |
| 191 | | | |
| 192 | /// Same as `Dir.rename`, except `new_sub_path` is relative to `new_dir` | 173 | /// Same as `Dir.rename`, except `new_sub_path` is relative to `new_dir` |
| 193 | pub fn rename(old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8) !void { | 174 | pub fn rename(old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8) !void { |
| 194 | return posix.renameat(old_dir.fd, old_sub_path, new_dir.fd, new_sub_path); | 175 | return posix.renameat(old_dir.fd, old_sub_path, new_dir.fd, new_sub_path); |
| ... | @@ -199,12 +180,6 @@ pub fn renameZ(old_dir: Dir, old_sub_path_z: [*:0]const u8, new_dir: Dir, new_su | ... | @@ -199,12 +180,6 @@ pub fn renameZ(old_dir: Dir, old_sub_path_z: [*:0]const u8, new_dir: Dir, new_su |
| 199 | return posix.renameatZ(old_dir.fd, old_sub_path_z, new_dir.fd, new_sub_path_z); | 180 | return posix.renameatZ(old_dir.fd, old_sub_path_z, new_dir.fd, new_sub_path_z); |
| 200 | } | 181 | } |
| 201 | | 182 | |
| 202 | /// Same as `rename` except the parameters are WTF16LE, NT prefixed. | | |
| 203 | /// This function is Windows-only. | | |
| 204 | pub fn renameW(old_dir: Dir, old_sub_path_w: []const u16, new_dir: Dir, new_sub_path_w: []const u16) !void { | | |
| 205 | return posix.renameatW(old_dir.fd, old_sub_path_w, new_dir.fd, new_sub_path_w, windows.TRUE); | | |
| 206 | } | | |
| 207 | | | |
| 208 | /// Returns a handle to the current working directory. It is not opened with iteration capability. | 183 | /// Returns a handle to the current working directory. It is not opened with iteration capability. |
| 209 | /// Closing the returned `Dir` is checked illegal behavior. Iterating over the result is illegal behavior. | 184 | /// Closing the returned `Dir` is checked illegal behavior. Iterating over the result is illegal behavior. |
| 210 | /// On POSIX targets, this function is comptime-callable. | 185 | /// On POSIX targets, this function is comptime-callable. |
| ... | @@ -241,12 +216,6 @@ pub fn openDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenOptions) | ... | @@ -241,12 +216,6 @@ pub fn openDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenOptions) |
| 241 | assert(path.isAbsoluteZ(absolute_path_c)); | 216 | assert(path.isAbsoluteZ(absolute_path_c)); |
| 242 | return cwd().openDirZ(absolute_path_c, flags); | 217 | return cwd().openDirZ(absolute_path_c, flags); |
| 243 | } | 218 | } |
| 244 | /// Same as `openDirAbsolute` but the path parameter is null-terminated. | | |
| 245 | pub fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenOptions) File.OpenError!Dir { | | |
| 246 | assert(path.isAbsoluteWindowsW(absolute_path_c)); | | |
| 247 | return cwd().openDirW(absolute_path_c, flags); | | |
| 248 | } | | |
| 249 | | | |
| 250 | /// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path. | 219 | /// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path. |
| 251 | /// Call `File.close` to release the resource. | 220 | /// Call `File.close` to release the resource. |
| 252 | /// Asserts that the path is absolute. See `Dir.openFile` for a function that | 221 | /// Asserts that the path is absolute. See `Dir.openFile` for a function that |
| ... | @@ -261,12 +230,6 @@ pub fn openFileAbsolute(absolute_path: []const u8, flags: File.OpenFlags) File.O | ... | @@ -261,12 +230,6 @@ pub fn openFileAbsolute(absolute_path: []const u8, flags: File.OpenFlags) File.O |
| 261 | return cwd().openFile(absolute_path, flags); | 230 | return cwd().openFile(absolute_path, flags); |
| 262 | } | 231 | } |
| 263 | | 232 | |
| 264 | /// Same as `openFileAbsolute` but the path parameter is WTF-16-encoded. | | |
| 265 | pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File { | | |
| 266 | assert(path.isAbsoluteWindowsWtf16(absolute_path_w)); | | |
| 267 | return cwd().openFileW(absolute_path_w, flags); | | |
| 268 | } | | |
| 269 | | | |
| 270 | /// Test accessing `path`. | 233 | /// Test accessing `path`. |
| 271 | /// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function. | 234 | /// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function. |
| 272 | /// For example, instead of testing if a file exists and then opening it, just | 235 | /// For example, instead of testing if a file exists and then opening it, just |
| ... | @@ -279,12 +242,6 @@ pub fn accessAbsolute(absolute_path: []const u8, flags: Io.Dir.AccessOptions) Di | ... | @@ -279,12 +242,6 @@ pub fn accessAbsolute(absolute_path: []const u8, flags: Io.Dir.AccessOptions) Di |
| 279 | assert(path.isAbsolute(absolute_path)); | 242 | assert(path.isAbsolute(absolute_path)); |
| 280 | try cwd().access(absolute_path, flags); | 243 | try cwd().access(absolute_path, flags); |
| 281 | } | 244 | } |
| 282 | /// Same as `accessAbsolute` but the path parameter is WTF-16 encoded. | | |
| 283 | pub fn accessAbsoluteW(absolute_path: [*:0]const u16, flags: File.OpenFlags) Dir.AccessError!void { | | |
| 284 | assert(path.isAbsoluteWindowsW(absolute_path)); | | |
| 285 | try cwd().accessW(absolute_path, flags); | | |
| 286 | } | | |
| 287 | | | |
| 288 | /// Creates, opens, or overwrites a file with write access, based on an absolute path. | 245 | /// Creates, opens, or overwrites a file with write access, based on an absolute path. |
| 289 | /// Call `File.close` to release the resource. | 246 | /// Call `File.close` to release the resource. |
| 290 | /// Asserts that the path is absolute. See `Dir.createFile` for a function that | 247 | /// Asserts that the path is absolute. See `Dir.createFile` for a function that |
| ... | @@ -311,12 +268,6 @@ pub fn deleteFileAbsolute(absolute_path: []const u8) Dir.DeleteFileError!void { | ... | @@ -311,12 +268,6 @@ pub fn deleteFileAbsolute(absolute_path: []const u8) Dir.DeleteFileError!void { |
| 311 | return cwd().deleteFile(absolute_path); | 268 | return cwd().deleteFile(absolute_path); |
| 312 | } | 269 | } |
| 313 | | 270 | |
| 314 | /// Same as `deleteFileAbsolute` except the parameter is WTF-16 encoded. | | |
| 315 | pub fn deleteFileAbsoluteW(absolute_path_w: [*:0]const u16) Dir.DeleteFileError!void { | | |
| 316 | assert(path.isAbsoluteWindowsW(absolute_path_w)); | | |
| 317 | return cwd().deleteFileW(mem.span(absolute_path_w)); | | |
| 318 | } | | |
| 319 | | | |
| 320 | /// Removes a symlink, file, or directory. | 271 | /// Removes a symlink, file, or directory. |
| 321 | /// This is equivalent to `Dir.deleteTree` with the base directory. | 272 | /// This is equivalent to `Dir.deleteTree` with the base directory. |
| 322 | /// Asserts that the path is absolute. See `Dir.deleteTree` for a function that | 273 | /// Asserts that the path is absolute. See `Dir.deleteTree` for a function that |
| ... | @@ -348,13 +299,6 @@ pub fn readLinkAbsolute(pathname: []const u8, buffer: *[max_path_bytes]u8) ![]u8 | ... | @@ -348,13 +299,6 @@ pub fn readLinkAbsolute(pathname: []const u8, buffer: *[max_path_bytes]u8) ![]u8 |
| 348 | return posix.readlink(pathname, buffer); | 299 | return posix.readlink(pathname, buffer); |
| 349 | } | 300 | } |
| 350 | | 301 | |
| 351 | /// Windows-only. Same as `readlinkW`, except the path parameter is null-terminated, WTF16 | | |
| 352 | /// encoded. | | |
| 353 | pub fn readlinkAbsoluteW(pathname_w: [*:0]const u16, buffer: *[max_path_bytes]u8) ![]u8 { | | |
| 354 | assert(path.isAbsoluteWindowsW(pathname_w)); | | |
| 355 | return posix.readlinkW(mem.span(pathname_w), buffer); | | |
| 356 | } | | |
| 357 | | | |
| 358 | /// Creates a symbolic link named `sym_link_path` which contains the string `target_path`. | 302 | /// Creates a symbolic link named `sym_link_path` which contains the string `target_path`. |
| 359 | /// A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent | 303 | /// A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent |
| 360 | /// one; the latter case is known as a dangling link. | 304 | /// one; the latter case is known as a dangling link. |