Skip to content

Commit

Permalink
Optimize indexing of directories
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Jul 14, 2024
1 parent 1adc58b commit e1e5ee3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/internal/fsindexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ void FilesystemIndexer::listDirectoryItems( std::vector< std::unique_ptr< Generi
const auto& currentEntry = *iterator;
const auto& itemPath = currentEntry.path();

const auto prefix = fs::relative( itemPath, basePath, error ).remove_filename();
const auto searchPath = includeRootPath ? mDirItem.inArchivePath() / prefix : prefix;

const auto itemIsDir = currentEntry.is_directory( error );
const auto itemName = path_to_tstring( itemPath.filename() );

Expand All @@ -63,6 +60,8 @@ void FilesystemIndexer::listDirectoryItems( std::vector< std::unique_ptr< Generi
* Note: The boolean expression uses short-circuiting to optimize the evaluation. */
const bool itemMatches = ( !mOnlyFiles || !itemIsDir ) && fsutil::wildcard_match( mFilter, itemName );
if ( itemMatches == shouldIncludeMatchedItems ) {
const auto prefix = fs::relative( itemPath, basePath, error ).remove_filename();
const auto searchPath = includeRootPath ? mDirItem.inArchivePath() / prefix : prefix;
result.emplace_back( std::make_unique< FilesystemItem >( currentEntry, searchPath, mSymlinkPolicy ) );
}

Expand Down

0 comments on commit e1e5ee3

Please sign in to comment.