fix
This commit is contained in:
parent
a23adf6db6
commit
68e3f6fc00
@ -35,7 +35,7 @@ auto traverse_directory(
|
|||||||
auto res{true};
|
auto res{true};
|
||||||
|
|
||||||
const auto is_stop_requested = [&stop_requested]() -> bool {
|
const auto is_stop_requested = [&stop_requested]() -> bool {
|
||||||
return (stop_requested != nullptr && !*stop_requested);
|
return (stop_requested != nullptr && *stop_requested);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -161,7 +161,7 @@ auto directory::create_directory(std::string_view path) const
|
|||||||
std::string{abs_path} + '|' +
|
std::string{abs_path} + '|' +
|
||||||
std::to_string(res));
|
std::to_string(res));
|
||||||
}
|
}
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
auto ret{true};
|
auto ret{true};
|
||||||
auto paths =
|
auto paths =
|
||||||
utils::string::split(abs_path, utils::path::directory_seperator, false);
|
utils::string::split(abs_path, utils::path::directory_seperator, false);
|
||||||
@ -169,6 +169,7 @@ auto directory::create_directory(std::string_view path) const
|
|||||||
std::string current_path;
|
std::string current_path;
|
||||||
for (std::size_t idx = 0U;
|
for (std::size_t idx = 0U;
|
||||||
!is_stop_requested() && ret && (idx < paths.size()); ++idx) {
|
!is_stop_requested() && ret && (idx < paths.size()); ++idx) {
|
||||||
|
|
||||||
if (paths.at(idx).empty()) {
|
if (paths.at(idx).empty()) {
|
||||||
current_path = utils::path::directory_seperator;
|
current_path = utils::path::directory_seperator;
|
||||||
continue;
|
continue;
|
||||||
@ -178,7 +179,7 @@ auto directory::create_directory(std::string_view path) const
|
|||||||
auto status = mkdir(current_path.c_str(), S_IRWXU);
|
auto status = mkdir(current_path.c_str(), S_IRWXU);
|
||||||
ret = ((status == 0) || (errno == EEXIST));
|
ret = ((status == 0) || (errno == EEXIST));
|
||||||
}
|
}
|
||||||
#endif
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
return std::make_unique<directory>(abs_path);
|
return std::make_unique<directory>(abs_path);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user