mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
42 lines
857 B
Text
42 lines
857 B
Text
// md: target should be a series of blank-delimited directories to be created
|
|
// If an element is a whildcard, the directory will always be created,
|
|
// using mkdir -p.
|
|
//
|
|
// uses: run()
|
|
|
|
// if the target directory does not exist it is created and its realpath is
|
|
// logged.
|
|
|
|
string g_lastLogged;
|
|
|
|
void md(string target)
|
|
{
|
|
int idx;
|
|
list paths;
|
|
string dir;
|
|
|
|
if (!exists(target))
|
|
run("mkdir -p " + target);
|
|
else if (((int)stat(target)[0] & S_IFDIR) == 0)
|
|
{
|
|
printf(target + " exists, but is not a directory\n");
|
|
exit(1);
|
|
}
|
|
|
|
|
|
if (g_installing)
|
|
{
|
|
target = cutEoln(backtick("realpath " + target)[0]);
|
|
if (target != g_lastLogged)
|
|
{
|
|
g_lastLogged = target;
|
|
mark();
|
|
g_log += (list)(g_logMark + " dir " + target);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|