fixed limitation of directory depth when indexing files

This commit is contained in:
csoler 2017-09-24 23:43:52 +02:00
parent abd7e25a2e
commit f497905497
2 changed files with 12 additions and 6 deletions

View File

@ -158,7 +158,7 @@ bool LocalDirectoryUpdater::sweepSharedDirectories()
return true ;
}
void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx,std::set<std::string>& existing_directories,int current_depth)
void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx,std::set<std::string>& existing_directories,uint32_t current_depth)
{
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << "[directory storage] parsing directory " << cumulated_path << ", index=" << indx << std::endl;
@ -209,7 +209,11 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
#endif
break;
case librs::util::FolderIterator::TYPE_DIR: subdirs.insert(dirIt.file_name());
case librs::util::FolderIterator::TYPE_DIR:
if(mMaxShareDepth > 0u && current_depth <= mMaxShareDepth)
subdirs.insert(dirIt.file_name());
#ifdef DEBUG_LOCAL_DIR_UPDATER
std::cerr << " adding sub-dir \"" << dirIt.file_name() << "\"" << std::endl;
#endif
@ -250,7 +254,6 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
// go through the list of sub-dirs and recursively update
if(mMaxShareDepth > 0 && current_depth <= mMaxShareDepth)
for(DirectoryStorage::DirIterator stored_dir_it(mSharedDirectories,indx) ; stored_dir_it; ++stored_dir_it)
{
#ifdef DEBUG_LOCAL_DIR_UPDATER
@ -352,7 +355,7 @@ int LocalDirectoryUpdater::maxShareDepth() const
return mMaxShareDepth ;
}
void LocalDirectoryUpdater::setMaxShareDepth(int d)
void LocalDirectoryUpdater::setMaxShareDepth(uint32_t d)
{
if(d != mMaxShareDepth)
mNeedsFullRecheck = true ;
@ -367,5 +370,8 @@ bool LocalDirectoryUpdater::ignoreDuplicates() const
void LocalDirectoryUpdater::setIgnoreDuplicates(bool b)
{
if(b != mIgnoreDuplicates)
mNeedsFullRecheck = true ;
mIgnoreDuplicates = b ;
}

View File

@ -58,7 +58,7 @@ public:
void setIgnoreLists(const std::list<std::string>& ignored_prefixes,const std::list<std::string>& ignored_suffixes,uint32_t ignore_flags) ;
bool getIgnoreLists(std::list<std::string>& ignored_prefixes,std::list<std::string>& ignored_suffixes,uint32_t& ignore_flags) const ;
void setMaxShareDepth(int i) ;
void setMaxShareDepth(uint32_t i) ;
int maxShareDepth() const;
void setIgnoreDuplicates(bool b) ;
@ -70,7 +70,7 @@ protected:
virtual void hash_callback(uint32_t client_param, const std::string& name, const RsFileHash& hash, uint64_t size);
virtual bool hash_confirm(uint32_t client_param) ;
void recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx, std::set<std::string>& existing_directories, int current_depth);
void recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx, std::set<std::string>& existing_directories, uint32_t current_depth);
bool sweepSharedDirectories();
private: