File: installentry

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (34 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
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;
}