#5435 Ensemble Import : File dialog report no matching files

Unity build causes file global static members to not work as expected.
This commit is contained in:
Magne Sjaastad
2020-01-30 12:42:22 +01:00
parent ce630c3067
commit 96fd4a1c9f
3 changed files with 22 additions and 23 deletions

View File

@@ -46,11 +46,6 @@
#define FIND_BUTTON_FIND_TEXT "Find"
#define FILES_FOUND_TEXT "Files Found"
//--------------------------------------------------------------------------------------------------
/// Internal variables
//--------------------------------------------------------------------------------------------------
static const QChar SEPARATOR = RiaFilePathTools::SEPARATOR;
//--------------------------------------------------------------------------------------------------
/// Internal functions
//--------------------------------------------------------------------------------------------------
@@ -250,7 +245,7 @@ QString RicRecursiveFileSearchDialog::pathFilterWithoutStartSeparator() const
QString rootDir = RiaFilePathTools::rootSearchPathFromSearchFilter( pathFilter );
pathFilter.remove( 0, rootDir.size() );
if ( pathFilter.startsWith( SEPARATOR ) ) pathFilter.remove( 0, 1 );
if ( pathFilter.startsWith( RiaFilePathTools::separator() ) ) pathFilter.remove( 0, 1 );
return pathFilter;
}
@@ -379,7 +374,7 @@ QStringList RicRecursiveFileSearchDialog::findMatchingFiles()
QString pathFilter = this->pathFilterWithoutStartSeparator();
QString rootDir = this->rootDirWithEndSeparator();
if ( rootDir.size() > 1 && rootDir.endsWith( SEPARATOR ) ) rootDir.chop( 1 );
if ( rootDir.size() > 1 && rootDir.endsWith( RiaFilePathTools::separator() ) ) rootDir.chop( 1 );
buildDirectoryListRecursiveSimple( rootDir, pathFilter, &dirs );
@@ -411,7 +406,7 @@ void RicRecursiveFileSearchDialog::buildDirectoryListRecursiveSimple( const QStr
return;
}
QStringList pathFilterPartList = pathFilter.split( SEPARATOR );
QStringList pathFilterPartList = pathFilter.split( RiaFilePathTools::separator() );
QDir qdir( currDir, pathFilterPartList[0], QDir::NoSort, QDir::Dirs | QDir::NoDotAndDotDot );
QStringList subDirs = qdir.entryList();
@@ -433,7 +428,7 @@ void RicRecursiveFileSearchDialog::buildDirectoryListRecursiveSimple( const QStr
{
auto pf = pathFilterPartList;
pf.removeFirst();
nextPathFilter = pf.join( SEPARATOR );
nextPathFilter = pf.join( RiaFilePathTools::separator() );
}
buildDirectoryListRecursiveSimple( fullPath, nextPathFilter, accumulatedDirs );
@@ -498,7 +493,7 @@ QStringList RicRecursiveFileSearchDialog::createFileNameFilterList()
void RicRecursiveFileSearchDialog::updateEffectiveFilter()
{
QString pathFilterText = pathFilterWithoutStartSeparator();
if ( pathFilterText == "*" || pathFilterText.endsWith( QString( SEPARATOR ) + "*" ) )
if ( pathFilterText == "*" || pathFilterText.endsWith( QString( RiaFilePathTools::separator() ) + "*" ) )
{
pathFilterText.chop( 1 );
pathFilterText = pathFilterText + "...";
@@ -789,7 +784,7 @@ QStringList RicRecursiveFileSearchDialog::buildDirectoryListRecursive( const QSt
QString pathFilter = this->pathFilterWithoutStartSeparator();
if ( !pathFilter.startsWith( "*" ) )
{
int wildcardIndex = pathFilter.indexOf( QRegExp( QString( "[*%1]" ).arg( SEPARATOR ) ) );
int wildcardIndex = pathFilter.indexOf( QRegExp( QString( "[*%1]" ).arg( RiaFilePathTools::separator() ) ) );
if ( wildcardIndex >= 0 )
{
currPathFilter = pathFilter.left( wildcardIndex + 1 );
@@ -826,7 +821,9 @@ QStringList RicRecursiveFileSearchDialog::buildDirectoryListRecursive( const QSt
bool RicRecursiveFileSearchDialog::pathFilterMatch( const QString& pathFilter, const QString& relPath )
{
QString pattern = pathFilter;
if ( relPath.endsWith( SEPARATOR ) && !pathFilter.endsWith( SEPARATOR ) ) pattern += SEPARATOR;
if ( relPath.endsWith( RiaFilePathTools::separator() ) && !pathFilter.endsWith( RiaFilePathTools::separator() ) )
pattern += RiaFilePathTools::separator();
QRegExp regexp( pattern, Qt::CaseInsensitive, QRegExp::Wildcard );
return regexp.exactMatch( relPath );
}