1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
void install_entry(string realSource, string dest, string realDest)
{
if (!installOK(dest, realDest))
return;
md(get_path(realDest));
if ((int)stat(realSource)[0] & S_IFDIR)
{
list parts = strtok(realDest, "/"); // components of realDest
int end = listlen(parts) - 1;
string dest = parts[ end ]; // the dest. class name
string dir; // the dir containing CLASSES
for (int idx = 0; idx != end; ++idx)
dir += '/' + parts[idx];
printf << "add " << dest << " to " << dir << "/CLASSES [yN] ? ";
if (getch() == 'y')
fprintf << dir + "/CLASSES" << dest << '\n';
printf << '\n';
}
syscall("cp -rd " + realSource + " " + realDest);
if (string icmconf = realDest + "/icmconf"; exists(icmconf))
{
syscall("cat " + icmconf + " >> " + g_icmconf);
syscall("rm " + icmconf);
}
// g_installed += (list)realDest;
}
|