Esempio n. 1
0
GlowingArcher::Text *GlowingArcher::SearchPath::FindFile(GlowingArcher::Text *fileName) const {
    Text *fullPath = 0;

    for (int idx = 127; idx >= 0; idx--) {
        if (paths[idx]) {
            fullPath = new Text(paths[idx], fileName);

            struct stat sb;
            if (stat(fullPath->CString(), &sb) == 0 && S_ISREG(sb.st_mode)) {
                // found file, return full path to it
                //
                break;
            }
            
            delete fullPath;
            fullPath = 0;
        }
    }

    return fullPath;
}