diff options
Diffstat (limited to 'zen/file_traverser.cpp')
-rw-r--r-- | zen/file_traverser.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/zen/file_traverser.cpp b/zen/file_traverser.cpp index 89eb6e48..bedc9154 100644 --- a/zen/file_traverser.cpp +++ b/zen/file_traverser.cpp @@ -113,7 +113,7 @@ void zen::traverseFolder(const Zstring& dirPath, struct ::dirent* dirEntry = nullptr; if (::readdir_r(folder, reinterpret_cast< ::dirent*>(&buffer[0]), &dirEntry) != 0) THROW_LAST_FILE_ERROR(replaceCpy(_("Cannot enumerate directory %x."), L"%x", fmtPath(dirPath)), L"readdir_r"); - //don't retry but restart dir traversal on error! http://blogs.msdn.com/b/oldnewthing/archive/2014/06/12/10533529.aspx + //don't retry but restart dir traversal on error! https://blogs.msdn.microsoft.com/oldnewthing/20140612-00/?p=753/ if (!dirEntry) //no more items return; @@ -124,22 +124,22 @@ void zen::traverseFolder(const Zstring& dirPath, if (itemNameRaw[0] == '.' && (itemNameRaw[1] == 0 || (itemNameRaw[1] == '.' && itemNameRaw[2] == 0))) continue; -#ifdef ZEN_MAC - //see native_traverser_impl.h: + +#ifdef ZEN_MAC //normalize all text input (see see native_traverser_impl.h) Zstring itemName; try { - itemName = osx::convertToPrecomposedUtf(itemNameRaw); //throw SysError + itemName = osx::normalizeUtfForPosix(itemNameRaw); //throw SysError } - catch (const SysError& e) //failure is not an item-level error since we don't have the proper decomposed name!!! + catch (const SysError& e) //failure is not an item-level error since we don't know the normalized name yet!!! { 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 + L"Failed to generate normalized file name: " + fmtPath(itemNameRaw) + L"\n" + e.toString()); //too obscure to warrant translation } #else const Zstring& itemName = itemNameRaw; #endif - if (itemName.empty()) //checks result of osx::convertToPrecomposedUtf, too! + if (itemName.empty()) //checks result of osx::normalizeUtfForPosix, 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; |