Replace call to `stat`, `lstat`, and `maybeLstat` with appropriate functions from `std::filesystem`
Motivation
The cpp std::filesystem has functions that we can use in place of stat and lstat. This makes the code more portable between windows and unix.
Some places where it required windows native implementation are still using unix::lstat (the old lstat just moved inside the new unix namespace). Alternative windows implementation needs to be written to tackle these situations.
Context
#9205
Priorities and Process
Add :+1: to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2024-06-24-nix-team-meeting-minutes-155/47739/1