mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-12-23 22:47:57 -05:00
fixup! fixup! fixup! fixup! Introduce Manager::addBooksFromDirectory()
This commit is contained in:
@@ -277,7 +277,12 @@ void Manager::addBooksFromDirectory(const std::string& path,
|
|||||||
for (const auto& dirEntry : fs::directory_iterator(currentPath)) {
|
for (const auto& dirEntry : fs::directory_iterator(currentPath)) {
|
||||||
auto resolvedPath = dirEntry.path();
|
auto resolvedPath = dirEntry.path();
|
||||||
if (fs::is_symlink(dirEntry)) {
|
if (fs::is_symlink(dirEntry)) {
|
||||||
resolvedPath = fs::canonical(dirEntry.path());
|
try {
|
||||||
|
resolvedPath = fs::canonical(dirEntry.path());
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
std::cerr << "Could not resolve symlink " << resolvedPath.u8string() << " to a valid path. Skipping..." << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const std::string pathString = resolvedPath.u8string();
|
const std::string pathString = resolvedPath.u8string();
|
||||||
std::string resolvedPathExtension = resolvedPath.extension();
|
std::string resolvedPathExtension = resolvedPath.extension();
|
||||||
|
|||||||
Reference in New Issue
Block a user