Directory::Directory(const String &DirectoryPath)
{
Load(DirectoryPath);
}
void Directory::Load(const String &DirectoryPath)
{
_DirectoryPath = DirectoryPath + "\\";
_Files.FreeMemory();
_Directories.FreeMemory();
WIN32_FIND_DATA FindResult;
HANDLE hFind = FindFirstFile((DirectoryPath + String("\\*")).CString(), &FindResult);
if (hFind == INVALID_HANDLE_VALUE)
{
return;
}
do
{
if (FindResult.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
String DirectoryName(FindResult.cFileName);
if(DirectoryName != String(".") &&
DirectoryName != String("..") &&
DirectoryName != String(".svn"))
{
_Directories.PushEnd(DirectoryName);
}
}
else
{
_Files.PushEnd(String(FindResult.cFileName));
}
}
while (FindNextFile(hFind, &FindResult) != 0);
FindClose(hFind);
}