Avoid unnecessary rescanning

This commit is contained in:
2015-11-19 01:00:22 +01:00
parent 0ef40dfe53
commit 826d6a15d8
3 changed files with 13 additions and 12 deletions

View File

@@ -274,9 +274,10 @@ void AccionFileNodeAux_MakeDir(char *pathOrig, char *pathDest) {
File_MakeDirectory(pathDest);
}
void ActionFileNode_RunList(ActionFileNode actionFileNode, char *pathLeft,
int ActionFileNode_RunList(ActionFileNode actionFileNode, char *pathLeft,
char *pathRight)
{
int numActions = 0;
char fullPathLeft[MaxPath], fullPathRight[MaxPath], showPath[MaxPath];
while (actionFileNode != NULL) {
if (actionFileNode->left) {
@@ -302,41 +303,42 @@ void ActionFileNode_RunList(ActionFileNode actionFileNode, char *pathLeft,
break;
case ActionFileCmp_LeftToRight:
printff(" => %s\n", showPath);
AccionFileNodeAux_Copy(fullPathLeft, fullPathRight);
AccionFileNodeAux_Copy(fullPathLeft, fullPathRight); numActions++;
break;
case ActionFileCmp_RightToLeft:
printff(" <= %s\n", showPath);
AccionFileNodeAux_Copy(fullPathRight, fullPathLeft);
AccionFileNodeAux_Copy(fullPathRight, fullPathLeft); numActions++;
break;
case ActionFileCmp_DeleteLeft:
printff(" *- %s\n", showPath);
AccionFileNodeAux_Delete(fullPathRight, fullPathLeft);
AccionFileNodeAux_Delete(fullPathRight, fullPathLeft); numActions++;
break;
case ActionFileCmp_DeleteRight:
printff(" -* %s\n", showPath);
AccionFileNodeAux_Delete(fullPathLeft, fullPathRight);
AccionFileNodeAux_Delete(fullPathLeft, fullPathRight); numActions++;
break;
case ActionFileCmp_DateLeftToRight:
printff(" -> %s\n", showPath);
AccionFileNodeAux_CopyDate(fullPathLeft, fullPathRight);
AccionFileNodeAux_CopyDate(fullPathLeft, fullPathRight); numActions++;
break;
case ActionFileCmp_DateRightToLeft:
printff(" <- %s\n", showPath);
AccionFileNodeAux_CopyDate(fullPathRight, fullPathLeft);
AccionFileNodeAux_CopyDate(fullPathRight, fullPathLeft); numActions++;
break;
case ActionFileCmp_MakeRightDirectory:
printff(" -D %s\n", showPath);
AccionFileNodeAux_MakeDir(fullPathLeft, fullPathRight);
AccionFileNodeAux_MakeDir(fullPathLeft, fullPathRight); numActions++;
break;
case ActionFileCmp_MakeLeftDirectory:
printff(" D- %s\n", showPath);
AccionFileNodeAux_MakeDir(fullPathRight, fullPathLeft);
AccionFileNodeAux_MakeDir(fullPathRight, fullPathLeft); numActions++;
break;
}
actionFileNode = actionFileNode->next;
}
printff("End\n");
return numActions;
}

View File

@@ -52,7 +52,7 @@ void ActionFileNode_Statistics(ActionFileNode actionFileNode,
void ActionFileNode_Print(ActionFileNode actionFileNode);
void ActionFileNode_RunList(ActionFileNode actionFileNode, char *pathLeft,
int ActionFileNode_RunList(ActionFileNode actionFileNode, char *pathLeft,
char *pathRight);

View File

@@ -230,8 +230,7 @@ int Sync(char *pathLeft, char *pathRight, int recheck, int dryRun) {
}
else {
// Run action list
ActionFileNode_RunList(actionFileNode, pathLeft, pathRight);
if (recheck) {
if (ActionFileNode_RunList(actionFileNode, pathLeft, pathRight)) {
CheckDir(pathLeft, recheck);
CheckDir(pathRight, recheck);
}