]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/preferences.cpp
fix windows compile, it's possible the linux build broke and will need misc tweaks...
[xonotic/netradiant.git] / radiant / preferences.cpp
index 2f6a45c466f2a5575416b2c1e7172bdd647f57b1..cd51e66009ca6ab7a32437a5b239c08805948074 100644 (file)
@@ -3282,24 +3282,18 @@ scan for active games that can be installed, based on the presence
 */
 void CGameInstall::ScanGames() {
        Str                             pakPaths = g_strAppPath.GetBuffer();
-       DIR                             *dir;
-       struct dirent   *dirlist;
        int                             iGame = 0;
+       const char              *dirname;
 
        pakPaths +=     "installs/";
-       dir = opendir( pakPaths.GetBuffer() );
-       if ( dir != NULL ) {
-               while ( ( dirlist = readdir( dir ) ) != NULL ) {
-                       if ( stricmp( dirlist->d_name, Q3_PACK ) == 0 ) {
-                               m_availGames[ iGame++ ] = GAME_Q3;
-                       }
-                       if ( stricmp( dirlist->d_name, URT_PACK ) == 0 ) {
-                               m_availGames[ iGame++ ] = GAME_URT;
-                       }
-                       if ( stricmp( dirlist->d_name, UFOAI_PACK ) == 0 ) {
-                               m_availGames[ iGame++ ] = GAME_UFOAI;
-                       }
+       FindFiles fileScan( pakPaths.GetBuffer() );
+       while ( ( dirname = fileScan.NextFile() ) != NULL ) {
+               if ( stricmp( dirname, Q3_PACK ) == 0 ) {
+                       m_availGames[ iGame++ ] = GAME_Q3;
                }
-               closedir( dir );
+               if ( stricmp( dirname, URT_PACK ) == 0 ) {
+                       m_availGames[ iGame++ ] = GAME_URT;
+               }               
        }
 }
+