mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-26 07:11:08 -04:00
added full re-scan when symbolic links are (des)activated, since the directory time stamps will not trigger an update
This commit is contained in:
parent
3f3efca22d
commit
2953957e66
2 changed files with 12 additions and 2 deletions
|
@ -44,6 +44,7 @@ LocalDirectoryUpdater::LocalDirectoryUpdater(HashStorage *hc,LocalDirectoryStora
|
||||||
mDelayBetweenDirectoryUpdates = DELAY_BETWEEN_DIRECTORY_UPDATES;
|
mDelayBetweenDirectoryUpdates = DELAY_BETWEEN_DIRECTORY_UPDATES;
|
||||||
mIsEnabled = false ;
|
mIsEnabled = false ;
|
||||||
mFollowSymLinks = FOLLOW_SYMLINKS_DEFAULT ;
|
mFollowSymLinks = FOLLOW_SYMLINKS_DEFAULT ;
|
||||||
|
mNeedsFullRebuild = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalDirectoryUpdater::isEnabled() const
|
bool LocalDirectoryUpdater::isEnabled() const
|
||||||
|
@ -70,6 +71,8 @@ void LocalDirectoryUpdater::data_tick()
|
||||||
if(now > mDelayBetweenDirectoryUpdates + mLastSweepTime)
|
if(now > mDelayBetweenDirectoryUpdates + mLastSweepTime)
|
||||||
{
|
{
|
||||||
sweepSharedDirectories() ;
|
sweepSharedDirectories() ;
|
||||||
|
|
||||||
|
mNeedsFullRebuild = false ;
|
||||||
mLastSweepTime = now;
|
mLastSweepTime = now;
|
||||||
mSharedDirectories->notifyTSChanged() ;
|
mSharedDirectories->notifyTSChanged() ;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +134,7 @@ void LocalDirectoryUpdater::sweepSharedDirectories()
|
||||||
recursUpdateSharedDir(stored_dir_it.name(), *stored_dir_it,existing_dirs) ; // here we need to use the list that was stored, instead of the shared dir list, because the two
|
recursUpdateSharedDir(stored_dir_it.name(), *stored_dir_it,existing_dirs) ; // here we need to use the list that was stored, instead of the shared dir list, because the two
|
||||||
// are not necessarily in the same order.
|
// are not necessarily in the same order.
|
||||||
}
|
}
|
||||||
|
|
||||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +168,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
if(mNeedsFullRebuild || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
||||||
// we only want to detect when the directory has changed on the disk
|
// we only want to detect when the directory has changed on the disk
|
||||||
{
|
{
|
||||||
// collect subdirs and subfiles
|
// collect subdirs and subfiles
|
||||||
|
@ -260,7 +264,12 @@ uint32_t LocalDirectoryUpdater::fileWatchPeriod() const
|
||||||
|
|
||||||
void LocalDirectoryUpdater::setFollowSymLinks(bool b)
|
void LocalDirectoryUpdater::setFollowSymLinks(bool b)
|
||||||
{
|
{
|
||||||
|
if(b != mFollowSymLinks)
|
||||||
|
mNeedsFullRebuild = true ;
|
||||||
|
|
||||||
mFollowSymLinks = b ;
|
mFollowSymLinks = b ;
|
||||||
|
|
||||||
|
forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalDirectoryUpdater::followSymLinks() const
|
bool LocalDirectoryUpdater::followSymLinks() const
|
||||||
|
|
|
@ -74,5 +74,6 @@ private:
|
||||||
uint32_t mDelayBetweenDirectoryUpdates;
|
uint32_t mDelayBetweenDirectoryUpdates;
|
||||||
bool mIsEnabled ;
|
bool mIsEnabled ;
|
||||||
bool mFollowSymLinks;
|
bool mFollowSymLinks;
|
||||||
|
bool mNeedsFullRebuild ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue