mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-04 13:15:52 +00:00
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
|
* @brief Insert glob matches into existing vector
|
||||||
* @param outPaths Vector to add matches to (will not erase existing contents)
|
* @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
|
* @brief Count how many directory levels deep in project path is
|
||||||
|
@ -463,7 +463,7 @@ static void VisitGlob(const ProjectPath& path,
|
|||||||
CookProgress& progress)
|
CookProgress& progress)
|
||||||
{
|
{
|
||||||
std::vector<ProjectPath> children;
|
std::vector<ProjectPath> children;
|
||||||
path.getGlobResults(children);
|
path.getGlobResults(children, path.getProject().getProjectRootPath().getAbsolutePath());
|
||||||
|
|
||||||
/* Pass 1: child file count */
|
/* Pass 1: child file count */
|
||||||
int childFileCount = 0;
|
int childFileCount = 0;
|
||||||
|
@ -151,7 +151,7 @@ Time ProjectPath::getModtime() const
|
|||||||
if (m_absPath.find(_S('*')) != SystemString::npos)
|
if (m_absPath.find(_S('*')) != SystemString::npos)
|
||||||
{
|
{
|
||||||
std::vector<ProjectPath> globResults;
|
std::vector<ProjectPath> globResults;
|
||||||
getGlobResults(globResults);
|
getGlobResults(globResults, m_proj->getProjectRootPath().getAbsolutePath());
|
||||||
for (ProjectPath& path : globResults)
|
for (ProjectPath& path : globResults)
|
||||||
{
|
{
|
||||||
if (!hecl::Stat(path.getAbsolutePath().c_str(), &theStat))
|
if (!hecl::Stat(path.getAbsolutePath().c_str(), &theStat))
|
||||||
@ -244,19 +244,22 @@ hecl::DirectoryEnumerator ProjectPath::enumerateDir() const
|
|||||||
return hecl::DirectoryEnumerator(m_absPath);
|
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;
|
SystemString itStr;
|
||||||
SystemRegexMatch letterMatch;
|
if (startPath == _S(""))
|
||||||
if (m_absPath.compare(0, 2, _S("//")))
|
{
|
||||||
itStr = _S("\\\\");
|
#if _WIN32
|
||||||
else if (std::regex_search(m_absPath, letterMatch, regDRIVELETTER))
|
SystemRegexMatch letterMatch;
|
||||||
if (letterMatch[1].str().size())
|
if (m_absPath.compare(0, 2, _S("//")))
|
||||||
itStr = letterMatch[1];
|
itStr = _S("\\\\");
|
||||||
|
else if (std::regex_search(m_absPath, letterMatch, regDRIVELETTER))
|
||||||
|
if (letterMatch[1].str().size())
|
||||||
|
itStr = letterMatch[1];
|
||||||
#else
|
#else
|
||||||
SystemString itStr = _S("/");
|
itStr = _S("/");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
_recursiveGlob(*m_proj, outPaths, m_absPath, itStr, false);
|
_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"));
|
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return false;
|
return false;
|
||||||
uint32_t buf;
|
uint32_t buf = 0;
|
||||||
if (fread(&buf, 1, 4, fp) != 4)
|
if (fread(&buf, 1, 4, fp) != 4)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -185,7 +185,7 @@ bool IsPathBlend(const hecl::ProjectPath& path)
|
|||||||
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
|
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("rb"));
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return false;
|
return false;
|
||||||
uint32_t buf;
|
uint32_t buf = 0;
|
||||||
if (fread(&buf, 1, 4, fp) != 4)
|
if (fread(&buf, 1, 4, fp) != 4)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user