fix: ImHex directories not being created correctly
This commit is contained in:
parent
6b20a9bdd5
commit
25df658653
@ -19,6 +19,6 @@ namespace hex {
|
|||||||
|
|
||||||
std::string getExecutablePath();
|
std::string getExecutablePath();
|
||||||
|
|
||||||
std::vector<std::string> getPath(ImHexPath path);
|
std::vector<std::string> getPath(ImHexPath path, bool listNonExisting = false);
|
||||||
|
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ namespace hex {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> getPath(ImHexPath path) {
|
std::vector<std::string> getPath(ImHexPath path, bool listNonExisting) {
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
@ -195,9 +195,11 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
result.erase(std::remove_if(result.begin(), result.end(), [](const auto& path){
|
if (!listNonExisting) {
|
||||||
return !std::filesystem::is_directory(path);
|
result.erase(std::remove_if(result.begin(), result.end(), [](const auto& path){
|
||||||
}), result.end());
|
return !std::filesystem::is_directory(path);
|
||||||
|
}), result.end());
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ namespace hex::init {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (auto path : paths) {
|
for (auto path : paths) {
|
||||||
for (auto &folder : hex::getPath(path)) {
|
for (auto &folder : hex::getPath(path, true)) {
|
||||||
try {
|
try {
|
||||||
std::filesystem::create_directories(folder);
|
std::filesystem::create_directories(folder);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
Loading…
Reference in New Issue
Block a user