Cook path directory creation

This commit is contained in:
Jack Andersen 2016-03-31 08:56:19 -10:00
parent 8e6ec6ecac
commit 6638463198
4 changed files with 29 additions and 4 deletions

View File

@ -78,9 +78,14 @@ private:
return hecl::Format("colorReg%u", idx);
}
std::string EmitLighting() const
std::string EmitLightingRGB() const
{
return std::string("lighting");
return std::string("lighting.rgb");
}
std::string EmitLightingAlpha() const
{
return std::string("lighting.a");
}
virtual std::string EmitVec3(const atVec4f& vec) const=0;

View File

@ -1109,6 +1109,25 @@ public:
*/
void makeDir() const {MakeDir(m_absPath.c_str());}
/**
* @brief Create directory chain leading up to path
* @param includeLastComp if set, the ProjectPath is assumed to be a
* directory, creating the final component
*/
void makeDirChain(bool includeLastComp) const
{
std::vector<hecl::SystemString> comps = getPathComponents();
auto end = comps.cend();
if (end != comps.cbegin() && !includeLastComp)
--end;
ProjectPath compPath(*m_proj, _S("."));
for (auto it=comps.cbegin() ; it != end ; ++it)
{
compPath = ProjectPath(compPath, *it);
compPath.makeDir();
}
}
/**
* @brief Fetch project that contains path
* @return Project

View File

@ -105,7 +105,7 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
else if (!name.compare("Lighting"))
{
m_lighting = true;
return EmitLighting();
return EmitLightingRGB();
}
else
diag.reportBackendErr(inst.m_loc, "unable to interpret '%s'", name.c_str());
@ -190,7 +190,7 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
else if (!name.compare("Lighting"))
{
m_lighting = true;
return EmitLighting();
return EmitLightingAlpha();
}
else
diag.reportBackendErr(inst.m_loc, "unable to interpret '%s'", name.c_str());

View File

@ -108,6 +108,7 @@ bool ClientProcess::syncCook(const hecl::ProjectPath& path, Database::IDataSpec*
if (specEnt)
{
hecl::ProjectPath cooked = path.getCookedPath(*specEnt);
cooked.makeDirChain(false);
spec->doCook(path, cooked, false, btok, [](const SystemChar*) {});
return true;
}