mirror of https://github.com/AxioDL/metaforce.git
Fix stack related crash in getGlobResults
This commit is contained in:
parent
279b4b1d68
commit
c4ee610169
|
@ -1165,8 +1165,9 @@ public:
|
|||
/**
|
||||
* @brief Insert glob matches into existing vector
|
||||
* @param outPaths Vector to add matches to (will not erase existing contents)
|
||||
* @param startPath Path to start searching for matches from
|
||||
*/
|
||||
void getGlobResults(std::vector<ProjectPath>& outPaths) const;
|
||||
void getGlobResults(std::vector<ProjectPath>& outPaths, const SystemString& startPath = _S("")) const;
|
||||
|
||||
/**
|
||||
* @brief Count how many directory levels deep in project path is
|
||||
|
|
|
@ -463,7 +463,7 @@ static void VisitGlob(const ProjectPath& path,
|
|||
CookProgress& progress)
|
||||
{
|
||||
std::vector<ProjectPath> children;
|
||||
path.getGlobResults(children);
|
||||
path.getGlobResults(children, path.getProject().getProjectRootPath().getAbsolutePath());
|
||||
|
||||
/* Pass 1: child file count */
|
||||
int childFileCount = 0;
|
||||
|
|
|
@ -151,7 +151,7 @@ Time ProjectPath::getModtime() const
|
|||
if (m_absPath.find(_S('*')) != SystemString::npos)
|
||||
{
|
||||
std::vector<ProjectPath> globResults;
|
||||
getGlobResults(globResults);
|
||||
getGlobResults(globResults, m_proj->getProjectRootPath().getAbsolutePath());
|
||||
for (ProjectPath& path : globResults)
|
||||
{
|
||||
if (!hecl::Stat(path.getAbsolutePath().c_str(), &theStat))
|
||||
|
@ -244,19 +244,22 @@ hecl::DirectoryEnumerator ProjectPath::enumerateDir() const
|
|||
return hecl::DirectoryEnumerator(m_absPath);
|
||||
}
|
||||
|
||||
void ProjectPath::getGlobResults(std::vector<ProjectPath>& outPaths) const
|
||||
void ProjectPath::getGlobResults(std::vector<ProjectPath>& outPaths, const SystemString& startPath) const
|
||||
{
|
||||
#if _WIN32
|
||||
SystemString itStr;
|
||||
SystemRegexMatch letterMatch;
|
||||
if (m_absPath.compare(0, 2, _S("//")))
|
||||
itStr = _S("\\\\");
|
||||
else if (std::regex_search(m_absPath, letterMatch, regDRIVELETTER))
|
||||
if (letterMatch[1].str().size())
|
||||
itStr = letterMatch[1];
|
||||
if (startPath == _S(""))
|
||||
{
|
||||
#if _WIN32
|
||||
SystemRegexMatch letterMatch;
|
||||
if (m_absPath.compare(0, 2, _S("//")))
|
||||
itStr = _S("\\\\");
|
||||
else if (std::regex_search(m_absPath, letterMatch, regDRIVELETTER))
|
||||
if (letterMatch[1].str().size())
|
||||
itStr = letterMatch[1];
|
||||
#else
|
||||
SystemString itStr = _S("/");
|
||||
itStr = _S("/");
|
||||
#endif
|
||||
}
|
||||
|
||||
_recursiveGlob(*m_proj, outPaths, m_absPath, itStr, false);
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ bool IsPathPNG(const hecl::ProjectPath& path)
|
|||
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
|
||||
if (!fp)
|
||||
return false;
|
||||
uint32_t buf;
|
||||
uint32_t buf = 0;
|
||||
if (fread(&buf, 1, 4, fp) != 4)
|
||||
{
|
||||
fclose(fp);
|
||||
|
@ -185,7 +185,7 @@ bool IsPathBlend(const hecl::ProjectPath& path)
|
|||
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
|
||||
if (!fp)
|
||||
return false;
|
||||
uint32_t buf;
|
||||
uint32_t buf = 0;
|
||||
if (fread(&buf, 1, 4, fp) != 4)
|
||||
{
|
||||
fclose(fp);
|
||||
|
|
Loading…
Reference in New Issue