00001 #pragma pack(8) 00002 #include <windows.h> 00003 #pragma pack() 00004 00005 #include "Common/Assert.h" 00006 00007 #include "Common/SearchFile.h" 00008 00009 //--------------------------------------------------------------------------------------------------------------------- 00010 KSearchFile::KSearchFile() 00011 { 00012 } 00013 00014 //--------------------------------------------------------------------------------------------------------------------- 00015 KSearchFile::KSearchFile( char* pPathName ) 00016 { 00017 NewSearch( pPathName ); 00018 } 00019 00020 //--------------------------------------------------------------------------------------------------------------------- 00021 KSearchFile::~KSearchFile() 00022 { 00023 Clean(); 00024 } 00025 00026 //--------------------------------------------------------------------------------------------------------------------- 00027 void KSearchFile::Clean() 00028 { 00029 u32 nFile = m_pFileList.GetSize(); 00030 00031 for( u32 i = 0; i < nFile; i ++ ) 00032 if( m_pFileList[i] ) 00033 free( m_pFileList[i] ); 00034 00035 m_pFileList.Clear(); 00036 } 00037 00038 00039 //--------------------------------------------------------------------------------------------------------------------- 00040 void KSearchFile::NewSearch( char* pPathName ) 00041 { 00042 Clean(); 00043 00044 WIN32_FIND_DATA Data; 00045 HANDLE Handle; 00046 00047 Handle = FindFirstFile( pPathName, &Data ); 00048 00049 if( Handle == INVALID_HANDLE_VALUE ) 00050 return; 00051 00052 do 00053 { 00054 m_pFileList.Add( strdup( Data.cFileName ) ); 00055 }while( FindNextFile( Handle, &Data ) ); 00056 00057 FindClose( Handle ); 00058 }
1.5.1-p1