diff --git a/hecl/extern/boo b/hecl/extern/boo index ce80446e8..579ddc822 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit ce80446e8b0fb82dc0afa6e2dd7f98303083c2da +Subproject commit 579ddc822c769998bdefa527476e13f834beee91 diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 2c0c961cc..054a92cd5 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -359,6 +359,8 @@ static inline void SNPrintf(SystemChar* str, size_t maxlen, const SystemChar* fo static inline int StrCmp(const SystemChar* str1, const SystemChar* str2) { + if (!str1 || !str2) + return str1 != str2; #if HECL_UCS2 return wcscmp(str1, str2); #else @@ -368,6 +370,8 @@ static inline int StrCmp(const SystemChar* str1, const SystemChar* str2) static inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t count) { + if (!str1 || !str2) + return str1 != str2; #if HECL_UCS2 return wcsncmp(str1, str2, count); #else @@ -377,6 +381,8 @@ static inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2) { + if (!str1 || !str2) + return str1 != str2; #if HECL_UCS2 return _wcsicmp(str1, str2); #else @@ -912,7 +918,7 @@ public: { size_t pos = m_relPath.rfind(_S('/')); if (pos == SystemString::npos) - return {}; + return m_relPath; return {m_relPath.c_str() + pos + 1, m_relPath.size() - pos - 1}; } std::string_view getLastComponentUTF8() const @@ -920,11 +926,11 @@ public: size_t pos = m_relPath.rfind(_S('/')); #if HECL_UCS2 if (pos == SystemString::npos) - return {}; + return m_utf8RelPath; return {m_utf8RelPath.c_str() + pos + 1, size_t(m_utf8RelPath.size() - pos - 1)}; #else if (pos == SystemString::npos) - return {}; + return m_relPath; return {m_relPath.c_str() + pos + 1, size_t(m_relPath.size() - pos - 1)}; #endif } diff --git a/hecl/lib/Project.cpp b/hecl/lib/Project.cpp index 9a755e561..878fcc79c 100644 --- a/hecl/lib/Project.cpp +++ b/hecl/lib/Project.cpp @@ -432,7 +432,7 @@ static void VisitDirectory(const ProjectPath& dir, std::vector>& specInsts, CookProgress& progress, ClientProcess* cp) { - if (dir.getLastComponent()[0] == _S('.')) + if (dir.getLastComponent().size() > 1 && dir.getLastComponent()[0] == _S('.')) return; std::map children; diff --git a/hecl/lib/ProjectPath.cpp b/hecl/lib/ProjectPath.cpp index b6d09f1db..bbcaa1da7 100644 --- a/hecl/lib/ProjectPath.cpp +++ b/hecl/lib/ProjectPath.cpp @@ -170,7 +170,8 @@ Time ProjectPath::getModtime() const } else if (S_ISDIR(theStat.st_mode)) { - hecl::DirectoryEnumerator de(m_absPath); + hecl::DirectoryEnumerator de(m_absPath, hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, + false, false, true); for (const hecl::DirectoryEnumerator::Entry& ent : de) { if (!hecl::Stat(ent.m_path.c_str(), &theStat)) @@ -218,7 +219,8 @@ static void _recursiveGlob(Database::Project& proj, /* Compile component into regex */ SystemRegex regComp(comp, SystemRegex::ECMAScript); - hecl::DirectoryEnumerator de(itStr); + hecl::DirectoryEnumerator de(itStr, hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, + false, false, true); for (const hecl::DirectoryEnumerator::Entry& ent : de) { if (std::regex_match(ent.m_name, regComp)) @@ -242,14 +244,16 @@ static void _recursiveGlob(Database::Project& proj, void ProjectPath::getDirChildren(std::map& outPaths) const { - hecl::DirectoryEnumerator de(m_absPath); + hecl::DirectoryEnumerator de(m_absPath, hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, + false, false, true); for (const hecl::DirectoryEnumerator::Entry& ent : de) outPaths[ent.m_name] = ProjectPath(*this, ent.m_name); } hecl::DirectoryEnumerator ProjectPath::enumerateDir() const { - return hecl::DirectoryEnumerator(m_absPath); + return hecl::DirectoryEnumerator(m_absPath, hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, + false, false, true); } void ProjectPath::getGlobResults(std::vector& outPaths) const