Logo Search packages:      
Sourcecode: inkscape version File versions

bool buildtool::MakeBase::listFiles ( MakeBase propRef,
FileSet fileSet 
) [protected, inherited]

Perform a listing for a fileset

Definition at line 3796 of file buildtool.cpp.

References buildtool::FileSet::getDirectory(), buildtool::FileSet::getExcludes(), buildtool::FileSet::getIncludes(), buildtool::MakeBase::listFiles(), buildtool::MakeBase::regexMatch(), buildtool::MakeBase::resolve(), and buildtool::FileSet::setFiles().

{
    String baseDir = propRef.resolve(fileSet.getDirectory());
    std::vector<String> fileList;
    if (!listFiles(baseDir, "", fileList))
        return false;

    std::vector<String> includes = fileSet.getIncludes();
    std::vector<String> excludes = fileSet.getExcludes();

    std::vector<String> incs;
    std::vector<String>::iterator iter;

    std::sort(fileList.begin(), fileList.end());

    //If there are <includes>, then add files to the output
    //in the order of the include list
    if (includes.size()==0)
        incs = fileList;
    else
        {
        for (iter = includes.begin() ; iter != includes.end() ; iter++)
            {
            String pattern = *iter;
            std::vector<String>::iterator siter;
            for (siter = fileList.begin() ; siter != fileList.end() ; siter++)
                {
                String s = *siter;
                if (regexMatch(s, pattern))
                    {
                    //trace("INCLUDED:%s", s.c_str());
                    incs.push_back(s);
                    }
                }
            }
        }

    //Now trim off the <excludes>
    std::vector<String> res;
    for (iter = incs.begin() ; iter != incs.end() ; iter++)
        {
        String s = *iter;
        bool skipme = false;
        std::vector<String>::iterator siter;
        for (siter = excludes.begin() ; siter != excludes.end() ; siter++)
            {
            String pattern = *siter;
            if (regexMatch(s, pattern))
                {
                //trace("EXCLUDED:%s", s.c_str());
                skipme = true;
                break;
                }
            }
        if (!skipme)
            res.push_back(s);
        }
        
    fileSet.setFiles(res);

    return true;
}


Generated by  Doxygen 1.6.0   Back to index