Various bug fixes

This commit is contained in:
Jack Andersen 2017-10-27 00:10:08 -10:00
parent 5e99ee1d95
commit a2c5d891b5
5 changed files with 40 additions and 14 deletions

View File

@ -21,10 +21,27 @@ class ToolPackage final : public ToolBase
m_selectedItems.push_back(path); 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) 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 dEnum(path.getAbsolutePath(),
hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, false, false, true); hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, false, false, true);
for (const auto& ent : dEnum) for (const auto& ent : dEnum)
@ -32,13 +49,12 @@ class ToolPackage final : public ToolBase
hecl::ProjectPath childPath(path, ent.m_name); hecl::ProjectPath childPath(path, ent.m_name);
if (ent.m_isDir) if (ent.m_isDir)
FindSelectedItems(childPath, checkGeneral && childPath.getPathComponents().size() <= 2); FindSelectedItems(childPath, checkGeneral && childPath.getPathComponents().size() <= 2);
else if (ent.m_name == _S("!world.blend")) else
AddSelectedItem(childPath); CheckFile(childPath);
} }
/* Directory with 2 components, not "Shared" and no nested !world.blend files == General PAK */ /* Directory with 2 components not "Shared" and no nested !world.blend files == General PAK */
if (path.getPathType() == hecl::ProjectPath::Type::Directory && checkGeneral && if (checkGeneral && origSize == m_selectedItems.size())
origSize == m_selectedItems.size())
{ {
auto pathComps = path.getPathComponents(); auto pathComps = path.getPathComponents();
if (pathComps.size() == 2 && pathComps[0] != _S("out") && pathComps[1] != _S("Shared")) if (pathComps.size() == 2 && pathComps[0] != _S("out") && pathComps[1] != _S("Shared"))

2
hecl/extern/athena vendored

@ -1 +1 @@
Subproject commit e3ce09d9146ff6175d34575bc68d043e6b55df3b Subproject commit 0fa861b708ac836323aadc673407a9a81e714ddb

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit d1b980b529fbb0540e9b53fb6c37f431def37c2b Subproject commit 3c207386e754e93638b094cd5b9b92ad4f2f8741

View File

@ -377,6 +377,15 @@ static inline int StrCmp(const SystemChar* str1, const SystemChar* str2)
#endif #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) static inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2)
{ {
#if HECL_UCS2 #if HECL_UCS2
@ -1239,7 +1248,7 @@ public:
size_t len = StrLen(test); size_t len = StrLen(test);
if (len > str.size()) if (len > str.size())
return false; return false;
return !StrCmp(str.data(), test); return !StrNCmp(str.data(), test, len);
} }
static bool EndsWith(const SystemString& str, const SystemChar* test) static bool EndsWith(const SystemString& str, const SystemChar* test)
@ -1247,7 +1256,7 @@ public:
size_t len = StrLen(test); size_t len = StrLen(test);
if (len > str.size()) if (len > str.size())
return false; return false;
return !StrCmp(&*(str.end() - len), test); return !StrNCmp(&*(str.end() - len), test, len);
} }
static std::string TrimWhitespace(const std::string& str) static std::string TrimWhitespace(const std::string& str)
@ -1267,7 +1276,7 @@ public:
size_t len = strlen(test); size_t len = strlen(test);
if (len > str.size()) if (len > str.size())
return false; return false;
return !strcmp(str.data(), test); return !strncmp(str.data(), test, len);
} }
static bool EndsWith(const std::string& str, const char* test) static bool EndsWith(const std::string& str, const char* test)
@ -1275,7 +1284,7 @@ public:
size_t len = strlen(test); size_t len = strlen(test);
if (len > str.size()) if (len > str.size())
return false; return false;
return !strcmp(&*(str.end() - len), test); return !strncmp(&*(str.end() - len), test, len);
} }
static SystemString TrimWhitespace(const SystemString& str) static SystemString TrimWhitespace(const SystemString& str)

View File

@ -98,7 +98,7 @@ static int Read(int fd, void* buf, size_t size)
} }
else else
return ret; return ret;
} while (intrCount < 3); } while (intrCount < 1000);
return -1; return -1;
} }
@ -117,7 +117,7 @@ static int Write(int fd, const void* buf, size_t size)
} }
else else
return ret; return ret;
} while (intrCount < 3); } while (intrCount < 1000);
return -1; return -1;
} }
@ -127,6 +127,7 @@ uint32_t BlenderConnection::_readStr(char* buf, uint32_t bufSz)
int ret = Read(m_readpipe[0], &readLen, 4); int ret = Read(m_readpipe[0], &readLen, 4);
if (ret < 4) if (ret < 4)
{ {
BlenderLog.report(logvisor::Error, "Pipe error %d %s", ret, strerror(errno));
_blenderDied(); _blenderDied();
return 0; return 0;
} }