You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.0 KiB
C++

//---------------------------------------------------------------------------
#ifndef SFindH
#define SFindH
//---------------------------------------------------------------------------
// Class to encapsulate a Win32Find (if a *.* '.' and '..' are filtered)
// Usage :
// SFind Find("*.*", "C:\\test");
// while (Find.Found())
// char *pFileName = Find.FileName();
//---------------------------------------------------------------------------
class SFind {
private:
HANDLE hFind;
HANDLE hFind2;
WIN32_FIND_DATA FindFileData;
char TempReturnFullFilename[MAX_PATH];
char ToSearch[MAX_PATH];
char SSearchPath[MAX_PATH];
char SSearchPattern[MAX_PATH];
public:
//--------------------------------------------------------------------
// Search For Files
// SearchMask is say *.*
// SearchPath path to search in, say C:\\shit or C:\\bob\\
//--------------------------------------------------------------------
SFind(char *SearchMask, char *SearchPath);
//--------------------------------------------------------------------
~SFind();
//--------------------------------------------------------------------
// Gets next search (returns true if it has something)
//--------------------------------------------------------------------
bool SFind::Found(void);
//--------------------------------------------------------------------
// returns true if the found item was a folder
//--------------------------------------------------------------------
bool SFind::IsFolder(void); // true if is a folder
//--------------------------------------------------------------------
// Returns the complete path and filename of the found item
//--------------------------------------------------------------------
char *FileName(void); // returns path + found file
//--------------------------------------------------------------------
// returns just the filename
//--------------------------------------------------------------------
char *JustFileName(void); // returns just found filename
};
#endif