mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
Local directories synchronization fails when preview is disabled, some differences are found, but none are selected
Source commit: ac93deb2ec5b4e47359093e1c87adeb63e0f6c83
This commit is contained in:
@@ -3266,6 +3266,7 @@ TSynchronizeChecklistFileOperation::TSynchronizeChecklistFileOperation(
|
||||
OleCheck(FFileOperation->Advise(FProgressSink, &UnusedCookie));
|
||||
|
||||
int Index = 0;
|
||||
FAny = false;
|
||||
const TSynchronizeChecklist::TItem * ChecklistItem;
|
||||
while (Checklist->GetNextChecked(Index, ChecklistItem))
|
||||
{
|
||||
@@ -3292,6 +3293,7 @@ TSynchronizeChecklistFileOperation::TSynchronizeChecklistFileOperation(
|
||||
TComPtr<IShellItem> Item = CreateShellItemFromParsingName(ItemPath);
|
||||
TComPtr<IShellItem> DestinationFolder = CreateShellItemFromParsingName(DestinationFolderPath);
|
||||
OleCheck(FFileOperation->CopyItem(Item.Get(), DestinationFolder.Get(), nullptr, nullptr));
|
||||
FAny = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3302,6 +3304,7 @@ TSynchronizeChecklistFileOperation::TSynchronizeChecklistFileOperation(
|
||||
ItemPath = Left ? ChecklistItem->GetLocalPath() : ChecklistItem->GetLocalPath2();
|
||||
TComPtr<IShellItem> Item = CreateShellItemFromParsingName(ItemPath);
|
||||
OleCheck(FFileOperation->DeleteItem(Item.Get(), nullptr));
|
||||
FAny = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -568,6 +568,7 @@ public:
|
||||
~TSynchronizeChecklistFileOperation();
|
||||
|
||||
__property IFileOperation * FileOperation = { read = GetFileOperation };
|
||||
__property bool Any = { read = FAny };
|
||||
|
||||
protected:
|
||||
void ProcessedItem(IShellItem * ShellItem);
|
||||
@@ -579,6 +580,7 @@ private:
|
||||
std::map<UnicodeString, const TSynchronizeChecklist::TItem *> FShellItems;
|
||||
TProcessedSynchronizationChecklistItem FOnProcessedItem;
|
||||
void * FToken;
|
||||
bool FAny;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
class TFileOperationProgressType;
|
||||
|
||||
@@ -6312,49 +6312,52 @@ void TCustomScpExplorerForm::SynchronizeApplyLocal(TSynchronizeChecklist * Check
|
||||
std::unique_ptr<TSynchronizeChecklistFileOperation> ChecklistFileOperation(
|
||||
new TSynchronizeChecklistFileOperation(Checklist, SynchronizeProcessedItem, &Params));
|
||||
|
||||
unsigned int OperationFlags =
|
||||
FOF_ALLOWUNDO |
|
||||
FOF_NOCONFIRMMKDIR |
|
||||
FOFX_RECYCLEONDELETE | // same effect as FOF_ALLOWUNDO?
|
||||
FLAGMASK(FLAGSET(Params.Params, TTerminal::spNoConfirmation), FOF_NOCONFIRMATION);
|
||||
IFileOperation * FileOperation = ChecklistFileOperation->FileOperation;
|
||||
OleCheck(FileOperation->SetOperationFlags(OperationFlags));
|
||||
if (ChecklistFileOperation->Any)
|
||||
{
|
||||
unsigned int OperationFlags =
|
||||
FOF_ALLOWUNDO |
|
||||
FOF_NOCONFIRMMKDIR |
|
||||
FOFX_RECYCLEONDELETE | // same effect as FOF_ALLOWUNDO?
|
||||
FLAGMASK(FLAGSET(Params.Params, TTerminal::spNoConfirmation), FOF_NOCONFIRMATION);
|
||||
IFileOperation * FileOperation = ChecklistFileOperation->FileOperation;
|
||||
OleCheck(FileOperation->SetOperationFlags(OperationFlags));
|
||||
|
||||
TForm * ActiveForm = Screen->ActiveForm;
|
||||
if (ActiveForm == this)
|
||||
{
|
||||
LockWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveForm->Enabled = false;
|
||||
}
|
||||
|
||||
FileOperation->SetOwnerWindow(ActiveForm->Handle);
|
||||
|
||||
try
|
||||
{
|
||||
HRESULT Result = FileOperation->PerformOperations();
|
||||
AppLogFmt(L"Performed %d", (int(Result)));
|
||||
BOOL Aborted;
|
||||
OleCheck(FileOperation->GetAnyOperationsAborted(&Aborted));
|
||||
if ((Result == HRESULT_FROM_WIN32(ERROR_CANCELLED)) || Aborted)
|
||||
{
|
||||
AppLog(L"Aborted");
|
||||
Abort();
|
||||
}
|
||||
AppLog(L"Checking");
|
||||
OleCheck(Result);
|
||||
}
|
||||
__finally
|
||||
{
|
||||
TForm * ActiveForm = Screen->ActiveForm;
|
||||
if (ActiveForm == this)
|
||||
{
|
||||
UnlockWindow();
|
||||
LockWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveForm->Enabled = true;
|
||||
ActiveForm->Enabled = false;
|
||||
}
|
||||
|
||||
FileOperation->SetOwnerWindow(ActiveForm->Handle);
|
||||
|
||||
try
|
||||
{
|
||||
HRESULT Result = FileOperation->PerformOperations();
|
||||
AppLogFmt(L"Performed %d", (int(Result)));
|
||||
BOOL Aborted;
|
||||
OleCheck(FileOperation->GetAnyOperationsAborted(&Aborted));
|
||||
if ((Result == HRESULT_FROM_WIN32(ERROR_CANCELLED)) || Aborted)
|
||||
{
|
||||
AppLog(L"Aborted");
|
||||
Abort();
|
||||
}
|
||||
AppLog(L"Checking");
|
||||
OleCheck(Result);
|
||||
}
|
||||
__finally
|
||||
{
|
||||
if (ActiveForm == this)
|
||||
{
|
||||
UnlockWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveForm->Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user