f1402849
dmayerich
renewed commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "rtsFilename.h"
#include <windows.h>
#include <vector>
vector<rtsFilename> rts_winGetFileList(const char* mask)
{
/*This function returns a list of file names based on the mask passed by
the user. The value returned is the number of rtsFilename elements in the
file_list parameter.*/
//create a temporary vector to store the file names
vector<rtsFilename> result;
//create a handle for the search
HANDLE search_handle;
WIN32_FIND_DATA found_data;
//start the search
search_handle = FindFirstFile((LPCSTR)mask, &found_data);
//loop through the rest of the data
rtsFilename new_file;
if(search_handle != INVALID_HANDLE_VALUE)
{
//save the first filename
new_file = found_data.cFileName;
result.push_back(new_file);
//now loop through the rest of the files
while(FindNextFile(search_handle, &found_data))
{
new_file = found_data.cFileName;
result.push_back(new_file);
}
}
return result;
}
|