aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fs.zig
AgeCommit message (Collapse)Author
2025-10-29std.Io.Threaded: add ioBasic which disables networkingAndrew Kelley
2025-10-29std.Io: introduce openSelfExeAndrew Kelley
2025-10-29std.Io.Threaded: implement dirOpenFile for WindowsAndrew Kelley
2025-10-29std.Io.Threaded: implement dirCreateFile for WindowsAndrew Kelley
2025-10-29std.Io.Threaded: implement dirAccess for WindowsAndrew Kelley
2025-10-29std.fs: use BadPathName rather than InvalidWtf8 on WindowsAndrew Kelley
2025-10-29std.Io: add dirAccessAndrew Kelley
2025-10-29std: fix macos compilation errorsAndrew Kelley
2025-10-29std.Io: implement dirOpenFileAndrew Kelley
2025-10-29WIP land the std.Io interfaceAndrew Kelley
fix std lib compilation errors caused by introducing std.Io
2025-10-29std.Io: extract Dir to separate fileAndrew Kelley
2025-10-27remove all Oracle Solaris supportAlex Rønne Petersen
There is no straightforward way for the Zig team to access the Solaris system headers; to do this, one has to create an Oracle account, accept their EULA to download the installer ISO, and finally install it on a machine or VM. We do not have to jump through hoops like this for any other OS that we support, and no one on the team has expressed willingness to do it. As a result, we cannot audit any Solaris contributions to std.c or other similarly sensitive parts of the standard library. The best we would be able to do is assume that Solaris and illumos are 100% compatible with no way to verify that assumption. But at that point, the solaris and illumos OS tags would be functionally identical anyway. For Solaris especially, any contributions that involve APIs introduced after the OS was made closed-source would also be inherently more risky than equivalent contributions for other proprietary OSs due to the case of Google LLC v. Oracle America, Inc., wherein Oracle clearly demonstrated its willingness to pursue legal action against entities that merely copy API declarations. Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in maintenance mode since, presumably to be retired completely sometime in the 2030s. For these reasons, this commit removes all Oracle Solaris support. Anyone who still wishes to use Zig on Solaris can try their luck by simply using illumos instead of solaris in target triples - chances are it'll work. But there will be no effort from the Zig team to support this use case; we recommend that people move to illumos instead.
2025-10-10replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/usebeforefree
2025-10-08Deprecate old realpathW correctlyMichael Pfaff
- Rename modified `realpathW` to `realpathW2` - Re-add original `realpathW` - Add deprecation notice to `realpathW`
2025-10-08Reuse pathname_w buffer as out_buffer when calling realpathWMichael Pfaff
2025-10-08Return WTF16LE encoded path from realpathWMichael Pfaff
2025-09-19std.fmt: migrate bufPrintZ to bufPrintSentinel (#25260)John Benediktsson
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-04-14Merge pull request #23268 from chrboesch/i19875Chris Boesch
std.posix: Added 'error.ProcessNotFound' where necessary
2025-03-11std: Add support for SerenityOS in various placesLinus Groh
Not nearly the entire downstream patchset but these are completely uncontroversial and known to work.
2024-10-17fix compilation errors for fs and fs.Dir (#21643)Justin Braben
* fix compilation errors for fs and fs.Dir * mem.span instead of mem.sliceTo * Updating symLinkAbsoluteW function parameters * Update with expected rename semantics
2024-07-28std.fs.Dir: Refactor atomicSymLink from std.fsCarter Snook
Deprecates std.fs.atomicSymLink and removes the allocator requirement from the new std.fs.Dir.atomicSymLink. Replaces the two usages of this within std. I did not include the TODOs from the original code that were based off of `switch (err) { ..., else => return err }` not having correct inference that cases handled in `...` are impossible in the error union return type because these are not specified in many places but I can add them back if wanted. Thank you @squeek502 for help with fixing buffer overflows!
2024-07-09std.fs.Dir: Rename OpenDirOptions to OpenOptions (#20542)Krzysztof Wolicki
* std.fs.Dir: Rename OpenDirOptions to OpenOptions https://ziglang.org/documentation/master/#Avoid-Redundant-Names-in-Fully-Qualified-Namespaces * std.fs.Dir: Add deprecated alias `OpenDirOptions`
2024-07-03Rename MAX_NAME_BYTES to max_name_bytesMichael Bradshaw
2024-06-13std: Convert deprecated aliases to compile errors and fix usagesRyan Liptak
Deprecated aliases that are now compile errors: - `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`) - `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`) - `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`) - `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`) - `std.unicode` + `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`) + `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`) - `std.zig.CrossTarget` (moved to `std.Target.Query`) Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are: - `std.rand` (renamed to `std.Random`) - `std.TailQueue` (renamed to `std.DoublyLinkedList`) - `std.ChildProcess` (renamed/moved to `std.process.Child`) This is not exhaustive. Deprecated aliases that I didn't touch: + `std.io.*` + `std.Build.*` + `std.builtin.Mode` + `std.zig.c_translation.CIntLiteralRadix` + anything in `src/`
2024-05-03Delete compile errors for deprecated declsRyan Liptak
2024-03-19fix compilation failures found by CIAndrew Kelley
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-03-16Windows: Replace CreatePipe with ntdll implementationStephen Gregoratto
This implementation is now a direct replacement for the `kernel32` one. New bitflags for named pipes and other generic ones were added based on browsing the ReactOS sources. `UNICODE_STRING.Buffer` has also been changed to be nullable, as this is what makes the implementation work. This required some changes to places accesssing the buffer after a `SUCCESS`ful return, most notably `QueryObjectName` which even referred to it being nullable.
2024-03-10improve documentation in stdAndrew Kelley
A lot of these "shorthand" doc comments were redundant, low quality filler content. Better to let the actual modules speak for themselves with top level doc comments rather than trying to document their aliases.
2024-02-27Eliminate `error.InvalidHandle` from OpenError and RealPathErrorRyan Liptak
InvalidHandle in OpenError is no longer a possible error on any platform. In the past it was able to be returned in `openOptionsFromFlagsWasi`, but the implementation was changed in 7680c5330cbc9141b9a5444e30c512b6068ab50d to make it no longer possible. InvalidHandle in RealPathError was a holdover from before d5312d53a066092ba9efd687e25b29a87eb6290c, which made realpath a compile error on WASI. However, InvalidHandle was also a possible error in the FreeBSD fallback implementation added in 537624734c4db9e0cdbdc0ebce57375d17172a70. This commit changes the FreeBSD fallback implementation to return FileNotFound instead of InvalidHandle which matches how EBADF is handled in all the other `realpath` implementations (including the FreeBSD non-fallback implementation). Closes #19084
2024-02-24Fix handling of Windows (WTF-16) and WASI (UTF-8) pathsRyan Liptak
Windows paths now use WTF-16 <-> WTF-8 conversion everywhere, which is lossless. Previously, conversion of ill-formed UTF-16 paths would either fail or invoke illegal behavior. WASI paths must be valid UTF-8, and the relevant function calls have been updated to handle the possibility of failure due to paths not being encoded/encodable as valid UTF-8. Closes #18694 Closes #1774 Closes #2565
2024-02-23setup PATH_MAX for emscriptenJae B
2024-02-01remove std.io.ModeVeikka Tuominen
2024-02-01remove std.eventVeikka Tuominen
2024-02-01std: change return type of `wasiCwd`Veikka Tuominen
`fd_t` is not declared on freestanding so returning a `Dir` causes an error.
2023-11-22std.fs.File: flatten structAndrew Kelley
2023-11-22std.fs: extract AtomicFile to separate fileAndrew Kelley
2023-11-22std.fs: extract Dir into separate fileAndrew Kelley
2023-11-22update for the std.fs.Dir changesAndrew Kelley
2023-11-22Revert "Merge pull request #12060 from Vexu/IterableDir"Andrew Kelley
This reverts commit da94227f783ec3c92859c4713b80a668f1183f96, reversing changes made to 8f943b3d33432a26b7e242c1181e4220ed400501. I was against this change originally, but decided to approve it to keep an open mind. After a year of trying it in practice, I firmly believe that the previous way of doing it was better.
2023-11-22std.fs: make deleteTree use ArrayList instead of BoundedArrayAndrew Kelley
We definitely want ArrayList in the standard library. Do we want BoundedArray? Maybe, maybe not. But that makes ArrayList a more stable dependency for std.fs.
2023-11-21Merge pull request #18055 from ziglang/zig-initAndrew Kelley
2023-11-21Do not assume that FILE_BOTH_DIR_INFORMATION is correctly alignedsalo-dea
2023-11-20merge `zig init-exe` and `zig init-lib` into `zig init`Andrew Kelley
Instead of `zig init-lib` and `zig init-exe`, now there is only `zig init`, which initializes any of the template files that do not already exist, and makes a package that contains both an executable and a static library. The idea is that the user can delete whatever they don't want. In fact, I think even more things should be added to the build.zig template.
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-10-26x86_64: implement `@divFloor` and `@mod` for `i128`Jacob Young
2023-10-23x86_64: implement 128-bit builtinsJacob Young
* `@clz` * `@ctz` * `@popCount` * `@byteSwap` * `@bitReverse` * various encodings used by std
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.