mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[saco] Implement and match DXUTFindMediaSearchParentDirs(...)
This commit is contained in:
parent
94c7b478af
commit
95be49b49c
@ -289,3 +289,35 @@ bool DXUTFindMediaSearchTypicalDirs( TCHAR* strSearchPath, int cchSearch, LPCTST
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Search parent directories starting at strStartAt, and appending strLeafName
|
||||
// at each parent directory. It stops at the root directory.
|
||||
//--------------------------------------------------------------------------------------
|
||||
bool DXUTFindMediaSearchParentDirs( TCHAR* strSearchPath, int cchSearch, TCHAR* strStartAt, TCHAR* strLeafName )
|
||||
{
|
||||
TCHAR strFullPath[MAX_PATH] = {0};
|
||||
TCHAR strFullFileName[MAX_PATH] = {0};
|
||||
TCHAR strSearch[MAX_PATH] = {0};
|
||||
TCHAR* strFilePart = NULL;
|
||||
|
||||
GetFullPathName( strStartAt, MAX_PATH, strFullPath, &strFilePart );
|
||||
if( strFilePart == NULL )
|
||||
return false;
|
||||
|
||||
while( strFilePart != NULL && *strFilePart != '\0' )
|
||||
{
|
||||
StringCchPrintf( strFullFileName, MAX_PATH, "%s\\%s", strFullPath, strLeafName );
|
||||
if( GetFileAttributes( strFullFileName ) != 0xFFFFFFFF )
|
||||
{
|
||||
StringCchCopy( strSearchPath, cchSearch, strFullFileName );
|
||||
return true;
|
||||
}
|
||||
|
||||
StringCchPrintf( strSearch, MAX_PATH, "%s\\..", strFullPath );
|
||||
GetFullPathName( strSearch, MAX_PATH, strFullPath, &strFilePart );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user