fs: Fix relative directory creation incongruity with Boost.filesystem
The non-BFS version of create_directory_if_missing_recursive() handles relative path names (e.g. "foo") correctly and doesn't attempt to create a parent that is left unspecified in the path (i.e. empty), but the BFS version does, predictably failing the whole operation. This fixes an issue where `./wesnoth -p data foo` from the source tree would fail with `error filesystem: Could not create parents to foo` if `foo` did not already exist, when using the Boost.filesystem-based implementation. `./wesnoth -p data ./foo` would succeed because there is a visible parent directory '.' that already exists and needs not be created again.
This commit is contained in:
parent
c87134f36e
commit
83907ce8ca
2 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
Version 1.11.19+dev:
|
||||
* Language and i18n:
|
||||
* Updated translations: German
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fixed recursive directory creation failing for working dir-relative paths
|
||||
without an explicit `./` at the start (e.g. in `wesnoth -p data/core foo`)
|
||||
for builds using Boost.filesystem.
|
||||
|
||||
Version 1.11.19:
|
||||
* Campaigns:
|
||||
|
|
|
@ -284,7 +284,7 @@ static bool create_directory_if_missing_recursive(const path& dirpath)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (create_directory_if_missing_recursive(dirpath.parent_path())) {
|
||||
if (!dirpath.has_parent_path() || create_directory_if_missing_recursive(dirpath.parent_path())) {
|
||||
return create_directory_if_missing(dirpath);
|
||||
} else {
|
||||
ERR_FS << "Could not create parents to " << dirpath.string() << '\n';
|
||||
|
|
Loading…
Add table
Reference in a new issue