[Project] Update FindFirst attributes in Common/path.h

This commit is contained in:
zilmar 2016-04-12 17:53:40 +10:00
parent cbba995b36
commit 7424f8bd9d
5 changed files with 16 additions and 11 deletions

View File

@ -852,15 +852,15 @@ bool CPath::MoveTo(const char * lpcszTargetFile, bool bOverwrite)
//-------------------------------------------------------------
bool CPath::AttributesMatch(uint32_t dwTargetAttributes, uint32_t dwFileAttributes)
{
if (dwTargetAttributes == _A_ALLFILES)
if (dwTargetAttributes == FIND_ATTRIBUTE_ALLFILES)
{
return true;
}
if (dwTargetAttributes == _A_NORMAL)
if (dwTargetAttributes == FIND_ATTRIBUTE_FILES)
{
return ((_A_SUBDIR & dwFileAttributes) == 0);
return ((FIND_ATTRIBUTE_SUBDIR & dwFileAttributes) == 0);
}
return (((dwTargetAttributes & dwFileAttributes) != 0) && ((_A_SUBDIR & dwTargetAttributes) == (_A_SUBDIR & dwFileAttributes)));
return (((dwTargetAttributes & dwFileAttributes) != 0) && ((FIND_ATTRIBUTE_SUBDIR & dwTargetAttributes) == (FIND_ATTRIBUTE_SUBDIR & dwFileAttributes)));
}
//-------------------------------------------------------------

View File

@ -20,7 +20,12 @@ public:
enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 2 };
enum DIR_MODULE_FILE { MODULE_FILE = 3 };
enum { _A_ALLFILES = 0xFFFF }; /* Search Include all files */
enum
{
FIND_ATTRIBUTE_ALLFILES = 0xFFFF, // Search Include all files
FIND_ATTRIBUTE_FILES = 0x0000, // File can be read or written to without restriction
FIND_ATTRIBUTE_SUBDIR = 0x0010, // Subdirectories
};
//Attributes
private:

View File

@ -188,8 +188,8 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
}
/* recursive read into sub-directory */
TextureDir.SetNameExtension("*.*");
if (TextureDir.FindFirst(_A_SUBDIR))
TextureDir.SetNameExtension("*");
if (TextureDir.FindFirst(CPath::FIND_ATTRIBUTE_SUBDIR))
{
do
{

View File

@ -51,8 +51,8 @@ bool CPluginList::LoadList()
void CPluginList::AddPluginFromDir(CPath Dir)
{
Dir.SetNameExtension("*.*");
if (Dir.FindFirst(_A_SUBDIR))
Dir.SetNameExtension("*");
if (Dir.FindFirst(CPath::FIND_ATTRIBUTE_SUBDIR))
{
do
{

View File

@ -510,7 +510,7 @@ bool CRomBrowser::GetRomFileNames(strlist & FileList, const CPath & BaseDirector
CPath SearchPath(BaseDirectory, "*.*");
SearchPath.AppendDirectory(Directory.c_str());
if (!SearchPath.FindFirst(CPath::_A_ALLFILES))
if (!SearchPath.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES))
{
return false;
}
@ -578,7 +578,7 @@ void CRomBrowser::FillRomList(strlist & FileList, const CPath & BaseDirectory, c
SearchPath.AppendDirectory(Directory.c_str());
WriteTrace(TraceUserInterface, TraceDebug, "1 %s", (const char *)SearchPath);
if (!SearchPath.FindFirst(CPath::_A_ALLFILES))
if (!SearchPath.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES))
{
return;
}