//---------------------------------------------------------------------------- void Win32Scanner::getFiles( tStringList & files ) { WIN32_FIND_DATA file; HANDLE hSearch; DWORD dwAttrs; bool done = false; hSearch = ::FindFirstFile( string( getCurrentDirectory() + "\\*.mp3" ).c_str(), &file ); if( hSearch != INVALID_HANDLE_VALUE ) { while( ! done ) { dwAttrs = ::GetFileAttributes( file.cFileName ); if( !(dwAttrs & FILE_ATTRIBUTE_SYSTEM) && !(dwAttrs & FILE_ATTRIBUTE_DIRECTORY) ) { files.push_back( file.cFileName ); } if( ! ::FindNextFile( hSearch, &file ) ) { if( ::GetLastError() == ERROR_NO_MORE_FILES ) { done = true; } else { error( getEnvironment(), "Couldn't find next file." ); } } } } static_cast<void>( ! ::FindClose( hSearch ) ); }
void cLowLevelSoundOpenAL::GetSupportedFormats(tStringList &alstFormats) { int lPos = 0; while(mvFormats[lPos]!="") { alstFormats.push_back(mvFormats[lPos]); lPos++; } }
//---------------------------------------------------------------------------- void Win32Scanner::getDirectories( tStringList & directories ) { WIN32_FIND_DATA file; HANDLE hSearch; DWORD dwAttrs; bool done = false; hSearch = ::FindFirstFile( string( getCurrentDirectory() + "\\*" ).c_str(), &file ); if( hSearch != INVALID_HANDLE_VALUE ) { while( ! done ) { dwAttrs = ::GetFileAttributes( file.cFileName ); if( !(dwAttrs & FILE_ATTRIBUTE_SYSTEM) && (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) && strcmp( file.cFileName, "." ) && strcmp( file.cFileName, ".." ) ) { // Not neccessary to check the current directory. // We are in! const string dir = getCurrentDirectory() + "\\" + file.cFileName; directories.push_back( dir ); } if( ! ::FindNextFile( hSearch, &file ) ) { if( ::GetLastError() == ERROR_NO_MORE_FILES ) { done = true; } else { error( getEnvironment(), "Couldn't find next file." ); } } } } static_cast<void>( ::FindClose( hSearch ) ); }
void ReflectionParser::CollectFiles(std::string const & inPath, tStringList & outFiles) { boost::filesystem::recursive_directory_iterator itEnd, it(inPath); while (it != itEnd) { if (!boost::filesystem::is_directory(*it)) { boost::filesystem::path path = *it; std::string filename = path.string(); std::string ext = GetFileExtension(filename); std::transform(ext.begin(), ext.end(), ext.begin(), tolower); if (((ext == "hpp") || (ext == "h")) && (filename.find(".generated.") == std::string::npos)) { outFiles.push_back(filename); } } try { ++it; } catch (std::exception & ex) { std::cout << ex.what() << std::endl; it.no_push(); try { ++it; } catch (...) { std::cout << ex.what() << std::endl; return; } } } }