aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zenremotestore/builds/buildstorageoperations.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/zenremotestore/builds/buildstorageoperations.cpp b/src/zenremotestore/builds/buildstorageoperations.cpp
index 6c370f975..f07f410ea 100644
--- a/src/zenremotestore/builds/buildstorageoperations.cpp
+++ b/src/zenremotestore/builds/buildstorageoperations.cpp
@@ -2699,6 +2699,8 @@ BuildsOperationUpdateFolder::FindScavengeSources()
{
ZEN_TRACE_CPU("FindScavengeSources");
+ const bool TargetPathExists = IsDir(m_Path);
+
std::vector<std::filesystem::path> StatePaths = GetDownloadedStatePaths(m_Options.SystemRootDir);
std::vector<ScavengeSource> Result;
@@ -2710,19 +2712,18 @@ BuildsOperationUpdateFolder::FindScavengeSources()
try
{
- BuildsDownloadInfo Info = ReadDownloadedInfoFile(EntryPath);
- if (!Info.LocalPath.empty() || !IsDir(Info.LocalPath))
+ BuildsDownloadInfo Info = ReadDownloadedInfoFile(EntryPath);
+ const bool LocalPathExists = !Info.LocalPath.empty() && IsDir(Info.LocalPath);
+ const bool LocalStateFileExists = IsFile(Info.StateFilePath);
+ if (LocalPathExists && LocalStateFileExists)
{
- if (!std::filesystem::equivalent(Info.LocalPath, m_Path))
+ if (TargetPathExists && std::filesystem::equivalent(Info.LocalPath, m_Path))
{
- if (IsDir(Info.LocalPath) && IsFile(Info.StateFilePath))
- {
- Result.push_back({.StateFilePath = std::move(Info.StateFilePath), .Path = std::move(Info.LocalPath)});
- }
- else
- {
- DeleteEntry = true;
- }
+ DeleteEntry = true;
+ }
+ else
+ {
+ Result.push_back({.StateFilePath = std::move(Info.StateFilePath), .Path = std::move(Info.LocalPath)});
}
}
else