Files
nix/src/libutil
John Ericson bbcf2041e1 File system error improvements
- Make `descriptorToPath` cross-platform (renamed from
  `windows::handleToPath`). Uses `/proc/self/fd` on Linux and
  `F_GETPATH` on macOS. Add `HAVE_F_GETPATH` meson check.

  This is based on 7226a116a0, which was
  removed in 479c356510, but is now
  introduced more judiciously.

- Unix error messages in `readFull`, `writeFull`, `readLine` now include
  file paths via `descriptorToPath`.

- Convert `std::filesystem::filesystem_error` to `SystemError`

  Wrappers like `readLink`, `createDirs`, `DirectoryIterator`, etc. now
  catch `std::filesystem::filesystem_error` and rethrow as `SystemError`
  with the error code preserved. This ensures consistent exception types
  throughout the codebase.

  Call sites that previously caught `filesystem_error` and rethrew with
  `throw;` now throw `SystemError(e.code(), ...)` instead.

  Some call sites can stop catching `filesystem_error` at all,
  because they only call the wrapped functions.

- Rework `SystemError` constructors to auto-append error message

  The public `SystemError(std::error_code, ...)` constructor now
  automatically appends `errorCode.message()` to the error message.
  A protected constructor takes an explicit error message string for
  subclasses.

  `SysError` delegates to the protected constructor with `strerror(errNo)`.
  `WinError` delegates with `renderError(lastError)` (now static).

  This removes the need to manually append `e.code().message()` at call
  sites when converting `filesystem_error` to `SystemError`.

- Use perfect forwarding (`Args &&...` with `std::forward`) consistently
  in `BaseError`, `SystemError`, `SysError`, and `WinError` constructors.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
2026-02-18 12:29:11 -05:00
..
2026-01-27 00:06:59 -05:00
2026-02-18 12:29:11 -05:00
2026-02-18 12:29:11 -05:00
2024-06-12 18:31:02 -04:00
2025-11-25 05:00:09 +00:00
2025-08-06 11:51:44 -04:00
2025-08-06 11:51:44 -04:00
2026-01-20 04:35:16 +03:00
2026-01-05 19:48:08 +00:00
2025-07-18 12:47:27 -04:00
2026-02-10 13:06:27 -05:00
2025-07-18 12:47:27 -04:00
2026-02-18 12:29:11 -05:00
2025-07-18 12:47:27 -04:00
2025-08-18 20:29:45 +03:00
2025-07-18 12:47:27 -04:00
2025-07-18 12:47:27 -04:00
2025-07-18 12:47:27 -04:00
2025-07-18 12:47:27 -04:00
2025-07-18 12:47:27 -04:00
2025-11-18 04:30:57 +03:00
2025-11-07 23:50:38 +01:00
2025-07-18 12:47:27 -04:00