Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrating some of the file stuff to std::filesystem, in the naive hope of getting better cross-platform compatibility #254

Merged
merged 5 commits into from
Jan 2, 2025

Conversation

ped7g
Copy link
Collaborator

@ped7g ped7g commented Dec 31, 2024

First part of #240 - migrating to std::filesystem goodies, parsing source and saving output files is now fully std::filesystem::path, include directories are checked by std::filesystem too.

Opening files (for various includes) is still degrading path to strings and operating upon them with old implementation, I have some idea how to rewrite it, starting with filename archive becoming std::set<...::path> and returning iterators to it (dereference those to get path/string), maybe even opening the file for "rb" automatically.

Needs more research and reshuffling of current code, so this will come as "part two".

But merging this part already to get working windows builds on master branch, this is technically fully working prod-quality version, as it should be with master branch head.

@ped7g ped7g added this to the v1.21.0 milestone Dec 31, 2024
@ped7g ped7g self-assigned this Dec 31, 2024
@ped7g ped7g added enhancement RFC Request For Comments (opinions) labels Dec 31, 2024
Related #240, should fix "check include paths" feature for windows, and
simplify somewhat code base (and get rid of home-made filename patching
functions, they seem robust enough and well tested, but I assume in the
long term having C++ standard library implementation is better, even if
it involves slightly more machine code executed here and there).

This is not thorough refactoring of whole code base, working on it bit
by bit, luckily the std::filesystem API is flexible enough to
connect/disconnect it to rest of code through char[] fields, so I can
replace the code partially and check test results.

Commit v2 (replacing lot more variables and code than first proof of
concept).
@ped7g ped7g force-pushed the std_fs_attempt branch 2 times, most recently from 36423ed to 1d417e4 Compare January 1, 2025 12:14
Making parser Get[Output]FileName to use std::filesystem::path hopefully
everywhere.

This get still degraded to std::string/const char* when include paths
are involved (GetPath, ArchiveFilename, Open/Include anything).

But committing this as intermittent step just in case I will be unable
to develop this further soon or if I need rollback to working version.
@ped7g ped7g marked this pull request as ready for review January 2, 2025 23:22
@ped7g ped7g merged commit faf8e4a into master Jan 2, 2025
12 checks passed
@ped7g ped7g deleted the std_fs_attempt branch January 2, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement RFC Request For Comments (opinions)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant