diff options
Diffstat (limited to 'zen/file_traverser.cpp')
-rw-r--r-- | zen/file_traverser.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/zen/file_traverser.cpp b/zen/file_traverser.cpp index aa39e508..89eb6e48 100644 --- a/zen/file_traverser.cpp +++ b/zen/file_traverser.cpp @@ -68,13 +68,13 @@ void zen::traverseFolder(const Zstring& dirPath, //skip "." and ".." const wchar_t* const itemNameRaw = findData.cFileName; - if (itemNameRaw[0] == 0) - throw FileError(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"FindNextFile: Data corruption; item with empty name."); - if (itemNameRaw[0] == L'.' && (itemNameRaw[1] == 0 || (itemNameRaw[1] == L'.' && itemNameRaw[2] == 0))) continue; + if (itemNameRaw[0] == 0) + throw FileError(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"FindNextFile: Data corruption; item with empty name."); + const Zstring& itemPath = appendSeparator(dirPath) + itemNameRaw; if (zen::isSymlink(findData)) //check first! @@ -121,9 +121,6 @@ void zen::traverseFolder(const Zstring& dirPath, //don't return "." and ".." const char* itemNameRaw = dirEntry->d_name; - if (itemNameRaw[0] == 0) - throw FileError(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"readdir_r: Data corruption; item with empty name."); - if (itemNameRaw[0] == '.' && (itemNameRaw[1] == 0 || (itemNameRaw[1] == '.' && itemNameRaw[2] == 0))) continue; @@ -134,15 +131,18 @@ void zen::traverseFolder(const Zstring& dirPath, { itemName = osx::convertToPrecomposedUtf(itemNameRaw); //throw SysError } - catch (const SysError& e) //failure is not an item-level error since wo don't have the proper decomposed name!!! + catch (const SysError& e) //failure is not an item-level error since we don't have the proper decomposed name!!! { throw FileError(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"Failed to generate precomposed file name: " + fmtPath(itemNameRaw) + L"\n" + e.toString()); //too obscure to warrant translation } - const Zstring& itemPath = appendSeparator(dirPath) + itemName; #else - const Zstring& itemPath = appendSeparator(dirPath) + itemNameRaw; + const Zstring& itemName = itemNameRaw; #endif + if (itemName.empty()) //checks result of osx::convertToPrecomposedUtf, too! + throw FileError(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"readdir_r: Data corruption; item with empty name."); + + const Zstring& itemPath = appendSeparator(dirPath) + itemName; struct ::stat statData = {}; try |