2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 07:47:42 +00:00

tool tweaks

This commit is contained in:
Jack Andersen
2015-06-11 18:02:23 -10:00
parent 518f246e5b
commit 8de863fcba
7 changed files with 79 additions and 258 deletions

View File

@@ -197,18 +197,13 @@ void ProjectPath::getGlobResults(std::vector<SystemString>& outPaths) const
_recursiveGlob(outPaths, 1, pathCompMatches, itStr, false);
}
ProjectRootPath* SearchForProject(const SystemString& path)
std::unique_ptr<ProjectRootPath> SearchForProject(const SystemString& path)
{
ProjectRootPath testRoot(path);
SystemString::const_iterator begin = testRoot.getAbsolutePath().begin();
SystemString::const_iterator end = testRoot.getAbsolutePath().end();
while (begin != end)
{
while (begin != end && *(end-1) != _S('/') && *(end-1) != _S('\\'))
--end;
if (begin == end)
break;
SystemString testPath(begin, end);
SystemString testIndexPath = testPath + _S("/.hecl/index");
struct stat theStat;
@@ -227,13 +222,15 @@ ProjectRootPath* SearchForProject(const SystemString& path)
static const HECL::FourCC hecl("HECL");
if (HECL::FourCC(magic) != hecl)
continue;
return new ProjectRootPath(testPath);
return std::unique_ptr<ProjectRootPath>(new ProjectRootPath(testPath));
}
}
while (begin != end && *(end-1) != _S('/') && *(end-1) != _S('\\'))
--end;
--end;
}
return NULL;
return std::unique_ptr<ProjectRootPath>();
}
}