///////////////////////////////////////////////////////////////////////// // case-sensitive string comparison bool vfeUnixSession::StrCompare (const UCS2String& lhs, const UCS2String& rhs) const { return lhs.compare(rhs); }
UCS2String BackendSceneData::FindFile(POVMSContext ctx, const UCS2String& filename, unsigned int stype) { vector<UCS2String> filenames; UCS2String foundfile; bool tryExactFirst; // if filename extension, matches one of the standard ones, try the exact name first // (otherwise, try it last) UCS2String::size_type pos = filename.find_last_of('.'); tryExactFirst = false; if (pos != UCS2String::npos) { for (size_t i = 0; i < POV_FILE_EXTENSIONS_PER_TYPE; i++) { if ( ( strlen(gPOV_File_Extensions[stype].ext[i]) > 0 ) && ( filename.compare(pos,filename.length()-pos, ASCIItoUCS2String(gPOV_File_Extensions[stype].ext[i])) == 0 ) ) { // match tryExactFirst = true; break; } } } // build list of files to search for if (tryExactFirst) filenames.push_back(filename); // add filename with extension variants to list of files to search for for (size_t i = 0; i < POV_FILE_EXTENSIONS_PER_TYPE; i++) { if (strlen(gPOV_File_Extensions[stype].ext[i]) > 0) { UCS2String fn(filename); fn += ASCIItoUCS2String(gPOV_File_Extensions[stype].ext[i]); filenames.push_back(fn); } } if (!tryExactFirst) filenames.push_back(filename); #ifdef USE_SCENE_FILE_MAPPING // see if the file is available locally for(vector<UCS2String>::const_iterator i(filenames.begin()); i != filenames.end(); i++) { FilenameToFilenameMap::iterator ilocalfile(scene2LocalFiles.find(*i)); if(ilocalfile != scene2LocalFiles.end()) return *i; } // see if the file is available as temporary file for(vector<UCS2String>::const_iterator i(filenames.begin()); i != filenames.end(); i++) { FilenameToFilenameMap::iterator itempfile(scene2TempFiles.find(*i)); if(itempfile != scene2TempFiles.end()) return *i; } #endif // otherwise, request to find the file RenderBackend::SendFindFile(ctx, sceneId, frontendAddress, filenames, foundfile); return foundfile; }