2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-03 07:55:52 +00:00

ProjectPath bug fixes

This commit is contained in:
Jack Andersen 2017-12-01 19:49:45 -10:00
parent c9f7d67318
commit d4ce1d4913
4 changed files with 19 additions and 9 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit ce80446e8b0fb82dc0afa6e2dd7f98303083c2da Subproject commit 579ddc822c769998bdefa527476e13f834beee91

View File

@ -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) static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
{ {
if (!str1 || !str2)
return str1 != str2;
#if HECL_UCS2 #if HECL_UCS2
return wcscmp(str1, str2); return wcscmp(str1, str2);
#else #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) static inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t count)
{ {
if (!str1 || !str2)
return str1 != str2;
#if HECL_UCS2 #if HECL_UCS2
return wcsncmp(str1, str2, count); return wcsncmp(str1, str2, count);
#else #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) static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2)
{ {
if (!str1 || !str2)
return str1 != str2;
#if HECL_UCS2 #if HECL_UCS2
return _wcsicmp(str1, str2); return _wcsicmp(str1, str2);
#else #else
@ -912,7 +918,7 @@ public:
{ {
size_t pos = m_relPath.rfind(_S('/')); size_t pos = m_relPath.rfind(_S('/'));
if (pos == SystemString::npos) if (pos == SystemString::npos)
return {}; return m_relPath;
return {m_relPath.c_str() + pos + 1, m_relPath.size() - pos - 1}; return {m_relPath.c_str() + pos + 1, m_relPath.size() - pos - 1};
} }
std::string_view getLastComponentUTF8() const std::string_view getLastComponentUTF8() const
@ -920,11 +926,11 @@ public:
size_t pos = m_relPath.rfind(_S('/')); size_t pos = m_relPath.rfind(_S('/'));
#if HECL_UCS2 #if HECL_UCS2
if (pos == SystemString::npos) if (pos == SystemString::npos)
return {}; return m_utf8RelPath;
return {m_utf8RelPath.c_str() + pos + 1, size_t(m_utf8RelPath.size() - pos - 1)}; return {m_utf8RelPath.c_str() + pos + 1, size_t(m_utf8RelPath.size() - pos - 1)};
#else #else
if (pos == SystemString::npos) if (pos == SystemString::npos)
return {}; return m_relPath;
return {m_relPath.c_str() + pos + 1, size_t(m_relPath.size() - pos - 1)}; return {m_relPath.c_str() + pos + 1, size_t(m_relPath.size() - pos - 1)};
#endif #endif
} }

View File

@ -432,7 +432,7 @@ static void VisitDirectory(const ProjectPath& dir,
std::vector<std::unique_ptr<IDataSpec>>& specInsts, std::vector<std::unique_ptr<IDataSpec>>& specInsts,
CookProgress& progress, ClientProcess* cp) CookProgress& progress, ClientProcess* cp)
{ {
if (dir.getLastComponent()[0] == _S('.')) if (dir.getLastComponent().size() > 1 && dir.getLastComponent()[0] == _S('.'))
return; return;
std::map<SystemString, ProjectPath> children; std::map<SystemString, ProjectPath> children;

View File

@ -170,7 +170,8 @@ Time ProjectPath::getModtime() const
} }
else if (S_ISDIR(theStat.st_mode)) 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) for (const hecl::DirectoryEnumerator::Entry& ent : de)
{ {
if (!hecl::Stat(ent.m_path.c_str(), &theStat)) if (!hecl::Stat(ent.m_path.c_str(), &theStat))
@ -218,7 +219,8 @@ static void _recursiveGlob(Database::Project& proj,
/* Compile component into regex */ /* Compile component into regex */
SystemRegex regComp(comp, SystemRegex::ECMAScript); 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) for (const hecl::DirectoryEnumerator::Entry& ent : de)
{ {
if (std::regex_match(ent.m_name, regComp)) if (std::regex_match(ent.m_name, regComp))
@ -242,14 +244,16 @@ static void _recursiveGlob(Database::Project& proj,
void ProjectPath::getDirChildren(std::map<SystemString, ProjectPath>& outPaths) const void ProjectPath::getDirChildren(std::map<SystemString, ProjectPath>& 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) for (const hecl::DirectoryEnumerator::Entry& ent : de)
outPaths[ent.m_name] = ProjectPath(*this, ent.m_name); outPaths[ent.m_name] = ProjectPath(*this, ent.m_name);
} }
hecl::DirectoryEnumerator ProjectPath::enumerateDir() const 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<ProjectPath>& outPaths) const void ProjectPath::getGlobResults(std::vector<ProjectPath>& outPaths) const