Made the lib work with -fno-exceptions (at least for now).
This commit is contained in:
@@ -57,18 +57,22 @@ std::vector<FileInfo> OSFileSystemAdapter::listFiles(const fs::path& folder)
|
||||
info.isSymlink = entry.is_symlink(err);
|
||||
info.isSpecial = !info.isFolder && !entry.is_regular_file(err);
|
||||
info.isHidden = info.path.filename().string().starts_with('.'); // at least for Linux
|
||||
if (info.isFolder) {
|
||||
try {
|
||||
if (info.isFolder)
|
||||
{
|
||||
MIJIN_TRY
|
||||
{
|
||||
info.size = std::distance(fs::directory_iterator(info.path), fs::directory_iterator());
|
||||
}
|
||||
catch(std::runtime_error&) {
|
||||
MIJIN_CATCH(std::runtime_error&)
|
||||
{
|
||||
info.size = 0;
|
||||
}
|
||||
}
|
||||
else if (!info.isSpecial)
|
||||
{
|
||||
info.size = entry.file_size(err);
|
||||
if (err) {
|
||||
if (err)
|
||||
{
|
||||
info.size = 0;
|
||||
}
|
||||
}
|
||||
@@ -89,10 +93,12 @@ FileInfo OSFileSystemAdapter::getFileInfo(const fs::path& file)
|
||||
info.isSpecial = !info.isFolder && !fs::is_regular_file(file, err);
|
||||
info.isHidden = info.path.filename().string().starts_with('.'); // at least for Linux
|
||||
if (info.isFolder) {
|
||||
try {
|
||||
MIJIN_TRY
|
||||
{
|
||||
info.size = std::distance(fs::directory_iterator(info.path), fs::directory_iterator());
|
||||
}
|
||||
catch(std::runtime_error&) {
|
||||
MIJIN_CATCH(std::runtime_error&)
|
||||
{
|
||||
info.size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user