Fix tests in Windows build.

This commit is contained in:
Martín Lucas Golini
2026-09-20 16:34:29 -03:00
parent 2beab631a2
commit 311d3e701a
3 changed files with 29 additions and 7 deletions
@@ -54,7 +54,11 @@ class ProjectDirectoryTreeTestDirectory {
}
std::string path( const std::string& relativePath = {} ) const {
return relativePath.empty() ? mPath.string() : ( mPath / relativePath ).string();
std::filesystem::path path( mPath );
if ( !relativePath.empty() )
path /= relativePath;
path.make_preferred();
return path.string();
}
private:
+10 -2
View File
@@ -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;
+14 -4
View File
@@ -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;
}