1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-08-02 12:47:07 +01:00

Hadrons: better handling of automatic directory creation

This commit is contained in:
2018-05-07 19:43:40 +01:00
parent 2017e4e3b4
commit f362c00739
4 changed files with 19 additions and 22 deletions

View File

@@ -158,3 +158,18 @@ std::string Hadrons::dirname(const std::string &s)
return "";
}
}
void Hadrons::makeFileDir(const std::string filename, GridBase *g)
{
if (g->IsBoss())
{
std::string dir = dirname(filename);
int status = mkdir(dir);
if (status)
{
HADRONS_ERROR(Io, "cannot create directory '" + dir
+ "' ( " + std::strerror(errno) + ")");
}
}
}