source: dev/trunk/ab5.0/jenga/src/common/FileSystem.cpp

Last change on this file was 829, checked in by イグトランス (egtra), 13 years ago

svn:eol-styleとsvn:mime-type(文字コード指定含む)の設定

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain; charset=Shift_JIS
File size: 982 bytes
Line 
1#include "stdafx.h"
2
3void Jenga::Common::FileSystem::SearchFiles( Jenga::Common::Strings &resultOfFullPath, const std::string &findStr, bool isNeedDirResults )
4{
5 // '/' → '\\'
6 std::string tempFindStr = findStr;
7 Jenga::Common::StringReplace( tempFindStr, "/", "\\" );
8
9 WIN32_FIND_DATA wfd;
10 HANDLE hFind=FindFirstFile( tempFindStr.c_str(), &wfd );
11
12 Jenga::Common::Path path( tempFindStr );
13 std::string dirPath = path.GetDirPath();
14 if( !dirPath.empty() && dirPath[dirPath.size()-1] == '\\' )
15 {
16 dirPath = dirPath.substr( 0, dirPath.size() - 1 );
17 }
18
19 if( hFind != INVALID_HANDLE_VALUE )
20 {
21 do
22 {
23 if( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
24 {
25 // ディレクトリのとき
26 if( isNeedDirResults )
27 {
28 resultOfFullPath.push_back( dirPath + "\\" + wfd.cFileName );
29 }
30 }
31 else
32 {
33 //ファイルのとき
34 resultOfFullPath.push_back( dirPath + "\\" + wfd.cFileName );
35 }
36 } while( FindNextFile( hFind, &wfd ) );
37
38 FindClose( hFind );
39 }
40}
Note: See TracBrowser for help on using the repository browser.