File: older.cc

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 (37 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (2)
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
35
36
37
#define XERR
#include "process.ih"

bool Process::older(string const &filename)
{
    ifstream in{ filename };                // open the file
    
    string line;
    while (getline(in, line))               // read all its lines
    {
        if (not (s_include << line))        // not an #include spec
            continue;

                                            // the spch.gch file is older
        if (d_spchGchTime < Stat{ s_include[1] }.lastModification())
//{
//xerr("  spchtime: " << d_spchGchTime << " older than " <<  s_include[1]);
//cin.ignore(100, '\n');
            return true;
//}

        fs::path parent = fs::path{ s_include[1] }.parent_path();
        if (parent != "")               // if the file has a path, go there
        {
            fs::path cwd = Tools::currentPath();   // remember the CWD
            Tools::currentPath(parent);
                                        // inspect the nested file
            bool old = older(fs::path{ s_include[1] }.filename());

            Tools::currentPath(cwd);
            if (old)
                return old;
        }
    }

    return false;
}