mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-01 18:50:16 +03:00
Fix tests in Windows build.
This commit is contained in:
@@ -131,7 +131,11 @@ bool IgnoreMatcherManager::match( const FileInfo& file ) const {
|
||||
localPath.clear();
|
||||
if ( String::startsWith( dirPath, matcher->getPath() ) )
|
||||
localPath = dirPath.substr( matcher->getPath().size() );
|
||||
if ( matcher->match( localPath + file.getFileName() ) )
|
||||
localPath += file.getFileName();
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN
|
||||
std::replace( localPath.begin(), localPath.end(), '\\', '/' );
|
||||
#endif
|
||||
if ( matcher->match( localPath ) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -144,7 +148,11 @@ bool IgnoreMatcherManager::match( const std::string& dir, const std::string& val
|
||||
localPath.clear();
|
||||
if ( String::startsWith( dir, matcher->getPath() ) )
|
||||
localPath = dir.substr( matcher->getPath().size() );
|
||||
if ( matcher->match( localPath + value ) )
|
||||
localPath += value;
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN
|
||||
std::replace( localPath.begin(), localPath.end(), '\\', '/' );
|
||||
#endif
|
||||
if ( matcher->match( localPath ) )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -396,16 +396,26 @@ bool ProjectDirectoryTree::shouldIgnoreEntry( const std::string& directory,
|
||||
if ( !mAllowedMatcher || !mAllowedMatcher->hasPatterns() )
|
||||
return true;
|
||||
std::string fullpath( directory + filename );
|
||||
std::string_view localPath( fullpath );
|
||||
size_t localPathOffset = 0;
|
||||
if ( String::startsWith( directory, mAllowedMatcher->getPath() ) )
|
||||
localPath.remove_prefix( mAllowedMatcher->getPath().size() );
|
||||
localPathOffset = mAllowedMatcher->getPath().size();
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN
|
||||
std::replace( fullpath.begin(), fullpath.end(), '\\', '/' );
|
||||
#endif
|
||||
std::string_view localPath( fullpath );
|
||||
localPath.remove_prefix( localPathOffset );
|
||||
if ( !mAllowedMatcher->match( localPath ) )
|
||||
return true;
|
||||
} else if ( mDisallowedMatcher && mDisallowedMatcher->hasPatterns() ) {
|
||||
std::string fullpath( directory + filename );
|
||||
std::string_view localPath( fullpath );
|
||||
size_t localPathOffset = 0;
|
||||
if ( String::startsWith( directory, mDisallowedMatcher->getPath() ) )
|
||||
localPath.remove_prefix( mDisallowedMatcher->getPath().size() );
|
||||
localPathOffset = mDisallowedMatcher->getPath().size();
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN
|
||||
std::replace( fullpath.begin(), fullpath.end(), '\\', '/' );
|
||||
#endif
|
||||
std::string_view localPath( fullpath );
|
||||
localPath.remove_prefix( localPathOffset );
|
||||
if ( mDisallowedMatcher->match( localPath ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user