diff --git a/hecl/driver/ToolPackage.hpp b/hecl/driver/ToolPackage.hpp index ddcb8a12d..013b8393e 100644 --- a/hecl/driver/ToolPackage.hpp +++ b/hecl/driver/ToolPackage.hpp @@ -21,10 +21,27 @@ class ToolPackage final : public ToolBase m_selectedItems.push_back(path); } + void CheckFile(const hecl::ProjectPath& path) + { + if (!hecl::StrCmp(path.getLastComponent(), _S("!world.blend"))) + AddSelectedItem(path); + else if (!hecl::StrCmp(path.getLastComponent(), _S("!original_ids.yaml"))) + { + auto pathComps = path.getPathComponents(); + if (pathComps.size() == 2 && pathComps[0] != _S("out")) + AddSelectedItem(path); + } + } + void FindSelectedItems(const hecl::ProjectPath& path, bool checkGeneral) { - size_t origSize = m_selectedItems.size(); + if (path.isFile()) + { + CheckFile(path); + return; + } + size_t origSize = m_selectedItems.size(); hecl::DirectoryEnumerator dEnum(path.getAbsolutePath(), hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, false, false, true); for (const auto& ent : dEnum) @@ -32,13 +49,12 @@ class ToolPackage final : public ToolBase hecl::ProjectPath childPath(path, ent.m_name); if (ent.m_isDir) FindSelectedItems(childPath, checkGeneral && childPath.getPathComponents().size() <= 2); - else if (ent.m_name == _S("!world.blend")) - AddSelectedItem(childPath); + else + CheckFile(childPath); } - /* Directory with 2 components, not "Shared" and no nested !world.blend files == General PAK */ - if (path.getPathType() == hecl::ProjectPath::Type::Directory && checkGeneral && - origSize == m_selectedItems.size()) + /* Directory with 2 components not "Shared" and no nested !world.blend files == General PAK */ + if (checkGeneral && origSize == m_selectedItems.size()) { auto pathComps = path.getPathComponents(); if (pathComps.size() == 2 && pathComps[0] != _S("out") && pathComps[1] != _S("Shared")) diff --git a/hecl/extern/athena b/hecl/extern/athena index e3ce09d91..0fa861b70 160000 --- a/hecl/extern/athena +++ b/hecl/extern/athena @@ -1 +1 @@ -Subproject commit e3ce09d9146ff6175d34575bc68d043e6b55df3b +Subproject commit 0fa861b708ac836323aadc673407a9a81e714ddb diff --git a/hecl/extern/boo b/hecl/extern/boo index d1b980b52..3c207386e 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit d1b980b529fbb0540e9b53fb6c37f431def37c2b +Subproject commit 3c207386e754e93638b094cd5b9b92ad4f2f8741 diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index cb41beab9..82b944769 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -377,6 +377,15 @@ static inline int StrCmp(const SystemChar* str1, const SystemChar* str2) #endif } +static inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t count) +{ +#if HECL_UCS2 + return wcsncmp(str1, str2, count); +#else + return strncmp(str1, str2, count); +#endif +} + static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2) { #if HECL_UCS2 @@ -1239,7 +1248,7 @@ public: size_t len = StrLen(test); if (len > str.size()) return false; - return !StrCmp(str.data(), test); + return !StrNCmp(str.data(), test, len); } static bool EndsWith(const SystemString& str, const SystemChar* test) @@ -1247,7 +1256,7 @@ public: size_t len = StrLen(test); if (len > str.size()) return false; - return !StrCmp(&*(str.end() - len), test); + return !StrNCmp(&*(str.end() - len), test, len); } static std::string TrimWhitespace(const std::string& str) @@ -1267,7 +1276,7 @@ public: size_t len = strlen(test); if (len > str.size()) return false; - return !strcmp(str.data(), test); + return !strncmp(str.data(), test, len); } static bool EndsWith(const std::string& str, const char* test) @@ -1275,7 +1284,7 @@ public: size_t len = strlen(test); if (len > str.size()) return false; - return !strcmp(&*(str.end() - len), test); + return !strncmp(&*(str.end() - len), test, len); } static SystemString TrimWhitespace(const SystemString& str) diff --git a/hecl/lib/Blender/BlenderConnection.cpp b/hecl/lib/Blender/BlenderConnection.cpp index ffa541b6c..c8c2ca9e3 100644 --- a/hecl/lib/Blender/BlenderConnection.cpp +++ b/hecl/lib/Blender/BlenderConnection.cpp @@ -98,7 +98,7 @@ static int Read(int fd, void* buf, size_t size) } else return ret; - } while (intrCount < 3); + } while (intrCount < 1000); return -1; } @@ -117,7 +117,7 @@ static int Write(int fd, const void* buf, size_t size) } else return ret; - } while (intrCount < 3); + } while (intrCount < 1000); return -1; } @@ -127,6 +127,7 @@ uint32_t BlenderConnection::_readStr(char* buf, uint32_t bufSz) int ret = Read(m_readpipe[0], &readLen, 4); if (ret < 4) { + BlenderLog.report(logvisor::Error, "Pipe error %d %s", ret, strerror(errno)); _blenderDied(); return 0; }