The ghc::filesystem we wanted to use for a platform compatible replacement of
std::filesystem (see D12197) doesn't behave as we expect or want to. We could
probably find a solution, but it's not worth the extra time. To move this
forward, we can switch the asset catalogs to use Blender's C functions for path
and filesystem handling.
Details
- Reviewers
Sybren A. Stüvel (sybren)
Diff Detail
- Repository
- rB Blender
- Branch
- temp-asset-browser-catalogs-c-filestuff (branched from master)
- Build Status
Buildable 17161 Build 17161: arc lint + arc unit
Event Timeline
| source/blender/blenkernel/intern/asset_catalog.cc | ||
|---|---|---|
| 80 | We could just use const char * only, but I prefer passing around StringRefs, even if we have to use .data() a lot. | |
| source/blender/blenkernel/intern/asset_catalog_test.cc | ||
| 50 | Note that BKE_tempdir_session() explicitly states that it has a trailing slash. So if the path is empty, concatenating with a / would result in /test-temporary-path. Think the std::filesystem::path::operator/() made sure a relative path doesn't become absolute because the parent is empty. | |
- Use StringRefNull to avoid pitfalls with non-terminated strings
The previous code using StringRef was fine logically, but I rather be explicit about what's expected to avoid errors when the code changes.
- Partially revert previous update
Thought the used StringRefNull constructor could construct a new,
null-terminated string. Of course that's wrong since it's a non owning type.
This is merged into the temp-asset-browser-catalogs branch now, which will be merged into master soon.