fix: Default folders still not being created correctly on Linux
This commit is contained in:
parent
495255484e
commit
c2b7b4a11e
@ -31,6 +31,17 @@ namespace hex::init {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isSubPathWritable(std::fs::path path) {
|
||||||
|
while (path.root_directory() != path) {
|
||||||
|
if (hex::fs::isPathWritable(path))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
path = path.parent_path();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool createDirectories() {
|
bool createDirectories() {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
@ -38,7 +49,7 @@ namespace hex::init {
|
|||||||
for (auto path : paths::All) {
|
for (auto path : paths::All) {
|
||||||
for (auto &folder : path->all()) {
|
for (auto &folder : path->all()) {
|
||||||
try {
|
try {
|
||||||
if (hex::fs::isPathWritable(folder.parent_path()))
|
if (isSubPathWritable(folder.parent_path()))
|
||||||
wolv::io::fs::createDirectories(folder);
|
wolv::io::fs::createDirectories(folder);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
log::error("Failed to create folder {}!", wolv::util::toUTF8String(folder));
|
log::error("Failed to create folder {}!", wolv::util::toUTF8String(folder));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user