Skip to content

Commit

Permalink
Propagate compare FileIO error status to parent directories (2)
Browse files Browse the repository at this point in the history
*  Allow hard FileIO error (or STOP error) status to be propagated to parent
directories during `Ctrl-F5` (Refresh Selected) operations.
  • Loading branch information
GreyMerlin authored and sdottaka committed Jan 5, 2019
1 parent 55f262a commit 224dc61
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Src/DirScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ static int CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffp
{
CDiffContext *pCtxt = myStruct->context;
int res = 0;
bool bCompareFailure = false;
uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);

while (pos != NULL)
Expand All @@ -610,23 +611,41 @@ static int CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffp
di.diffcode.diffcode |= DIFFCODE::DIFF;
res += ndiff;
}
else if (ndiff == 0)
else
if (ndiff == 0)
{
if (existsalldirs)
di.diffcode.diffcode |= DIFFCODE::SAME;
}
else
if (ndiff == -1)
{ // There were file IO-errors during sub-directory comparison.
di.diffcode.diffcode |= DIFFCODE::CMPERR;
bCompareFailure = true;
}
}
}
else
{
if (di.diffcode.isScanNeeded())
CompareDiffItem(di, pCtxt);
{
CompareDiffItem(di, pCtxt);
if (di.diffcode.isResultError()) {
DIFFITEM *diParent = di.parent;
if (diParent != nullptr)
{
diParent->diffcode.diffcode |= DIFFCODE::CMPERR;
bCompareFailure = true;
}
}

}
}
if (di.diffcode.isResultDiff() ||
(!existsalldirs && !di.diffcode.isResultFiltered()))
res++;
}
return res;
return bCompareFailure ? -1 : res;;
}

int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
Expand Down

0 comments on commit 224dc61

Please sign in to comment.