Logo Search packages:      
Sourcecode: inkscape version File versions

bool buildtool::MakeBase::listDirectories ( const String &  baseName,
const String &  dirname,
std::vector< String > &  res 
) [protected, inherited]

List all directories in a given base and starting directory It is usually called like: bool ret = listDirectories("src", "", result);

Definition at line 3684 of file buildtool.cpp.

References buildtool::MakeBase::error(), and buildtool::MakeBase::getNativePath().

{
    res.push_back(dirName);
    String fullPath = baseName;
    if (dirName.size()>0)
        {
        fullPath.append("/");
        fullPath.append(dirName);
        }
    DIR *dir = opendir(fullPath.c_str());
    while (true)
        {
        struct dirent *de = readdir(dir);
        if (!de)
            break;

        //Get the directory member name
        String s = de->d_name;
        if (s.size() == 0 || s[0] == '.')
            continue;
        String childName = dirName;
        childName.append("/");
        childName.append(s);

        String fullChildPath = baseName;
        fullChildPath.append("/");
        fullChildPath.append(childName);
        struct stat finfo;
        String childNative = getNativePath(fullChildPath);
        if (stat(childNative.c_str(), &finfo)<0)
            {
            error("cannot stat file:%s", childNative.c_str());
            }
        else if (S_ISDIR(finfo.st_mode))
            {
            //trace("directory: %s", childName.c_str());
            if (!listDirectories(baseName, childName, res))
                return false;
            }
        }
    closedir(dir);

    return true;
}


Generated by  Doxygen 1.6.0   Back to index