Skip to content

Fix mingw build (once again), add openFileReadonly and clean up error.hh to include WinError#14962

Merged
xokdvium merged 2 commits intomasterfrom
fix-mingw
Jan 10, 2026
Merged

Fix mingw build (once again), add openFileReadonly and clean up error.hh to include WinError#14962
xokdvium merged 2 commits intomasterfrom
fix-mingw

Conversation

@xokdvium
Copy link
Contributor

@xokdvium xokdvium commented Jan 9, 2026

This way each consumer of NativeSysError doesn't have to
also conditionally include the windows-error.hh, which is very cumbersome.
And we can't include windows-error.hh in error.hh because of a circular import.
This also adds a utility for opening a file descriptor from a path in readonly mode.
Previous commit helps a bit with error handling, since now we just throw a NativeSysError.
assert(cacheDir);
return (*cacheDir / hashPart) + "." + ext;
auto res = (*cacheDir / hashPart);
res.concat(concatStrings(".", ext));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not two += instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty equivalent. More of a matter of taste

*
* @note For directories use @ref openDirectory.
*/
Descriptor openFileReadonly(const std::filesystem::path & path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git grep O_RDONLY makes me think this could perhaps be used in more places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, yeah.

@xokdvium xokdvium added this pull request to the merge queue Jan 10, 2026
Merged via the queue into master with commit 6970efe Jan 10, 2026
19 checks passed
@xokdvium xokdvium deleted the fix-mingw branch January 10, 2026 01:27
JustAGuyTryingHisBest pushed a commit to JustAGuyTryingHisBest/nix that referenced this pull request Jan 12, 2026
Fix mingw build (once again), add openFileReadonly and clean up error.hh to include WinError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants