EgtGeneral :
- agg. funzione FindFirstFileEgt.
This commit is contained in:
+30
-1
@@ -60,6 +60,35 @@ FileExtensionMatches( const string& sFile, const string& sExt)
|
||||
return ( sFileExt == sExtUp) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
FindFirstFileEgt( const string& sFileSpec, string& sFileName)
|
||||
{
|
||||
wstring sFileSpecW ;
|
||||
wstring sFileW ;
|
||||
_wfinddata_t c_file ;
|
||||
intptr_t hFile ;
|
||||
|
||||
|
||||
sFileSpecW = stringtoW( sFileSpec) ;
|
||||
|
||||
// cerco il primo file che soddisfa le specifiche
|
||||
if ( ( hFile = _wfindfirst( sFileSpecW.c_str(), &c_file)) != -1L) {
|
||||
do {
|
||||
if ( c_file.attrib != _A_SUBDIR) {
|
||||
sFileName = LPSTR( WtoA( c_file.name)) ;
|
||||
_findclose( hFile) ;
|
||||
errno = 0 ;
|
||||
return true ;
|
||||
}
|
||||
} while( _wfindnext( hFile, &c_file) == 0) ;
|
||||
_findclose( hFile) ;
|
||||
errno = 0 ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
EmptyDirectory( const string& sDir)
|
||||
@@ -86,4 +115,4 @@ EmptyDirectory( const string& sDir)
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user