Ignore:
Timestamp:
Jul 12, 2008, 9:22:58 PM (16 years ago)
Author:
dai_9181
Message:

Directory::SearchFilesメソッドを追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/jenga/src/common/Directory.cpp

    r620 r680  
    138138    return temp;
    139139}
     140
     141void Directory::SearchFiles( Jenga::Common::Strings &resultOfFullPath, const std::string &findStr, bool isRecuresive ) const
     142{
     143    Jenga::Common::Strings result;
     144
     145    WIN32_FIND_DATA wfd;
     146    HANDLE hFind=FindFirstFile( ( this->path + "\\" + findStr ).c_str(), &wfd );
     147    if( hFind != INVALID_HANDLE_VALUE )
     148    {
     149        do
     150        {
     151            if( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
     152            {
     153                // ディレクトリのとき
     154                if( isRecuresive )
     155                {
     156                    Directory tempDir( this->path + "\\" + wfd.cFileName );
     157                    tempDir.SearchFiles( resultOfFullPath, findStr, isRecuresive );
     158                }
     159            }
     160            else
     161            {
     162                //ファイルのとき
     163                resultOfFullPath.push_back( this->path + "\\" + wfd.cFileName );
     164            }
     165        } while( FindNextFile( hFind, &wfd ) );
     166
     167        FindClose( hFind );
     168    }
     169}
Note: See TracChangeset for help on using the changeset viewer.