-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitUtils.cpp
More file actions
29 lines (22 loc) · 780 Bytes
/
UnitUtils.cpp
File metadata and controls
29 lines (22 loc) · 780 Bytes
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
//---------------------------------------------------------------------------
#pragma hdrstop
#include "UnitUtils.h"
//create a new StringList of all the files in given directory
TStringList* __fastcall ListFilesInDirectory(AnsiString Dir)
{
WIN32_FIND_DATA findFileData;
HANDLE hFind = FindFirstFile(Dir.c_str(), &findFileData);
TStringList* sl = new TStringList();
if(hFind == INVALID_HANDLE_VALUE) {
return sl;
}
int fileNumber = 0;
sl->Add(findFileData.cFileName);
while(FindNextFile(hFind, &findFileData)) {
sl->Add(findFileData.cFileName);
}
FindClose(hFind);
return sl;
}
//---------------------------------------------------------------------------
#pragma package(smart_init)