diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:14:37 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:14:37 +0200 |
commit | 8bf668665b107469086f16cb8ad23e47d479d2b4 (patch) | |
tree | 66a91ef06a8caa7cd6819dcbe1860693d3eda8d5 /shared/IFileOperation/file_op.cpp | |
parent | 3.21 (diff) | |
download | FreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.tar.gz FreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.tar.bz2 FreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.zip |
4.0
Diffstat (limited to 'shared/IFileOperation/file_op.cpp')
-rw-r--r-- | shared/IFileOperation/file_op.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/shared/IFileOperation/file_op.cpp b/shared/IFileOperation/file_op.cpp index a2cf9413..8b632972 100644 --- a/shared/IFileOperation/file_op.cpp +++ b/shared/IFileOperation/file_op.cpp @@ -61,13 +61,15 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[], return false; } + int operationCount = 0; + for (size_t i = 0; i < fileNo; ++i) { //create file/folder item object ComPtr<IShellItem> psiFile; - hr = SHCreateItemFromParsingName(fileNames[i], - NULL, - IID_PPV_ARGS(psiFile.init())); + hr = ::SHCreateItemFromParsingName(fileNames[i], + NULL, + IID_PPV_ARGS(psiFile.init())); if (FAILED(hr)) { if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || //file not existing anymore @@ -87,8 +89,13 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[], lastErrorMessage = generateErrorMsg(L"Error calling \"DeleteItem\".", hr); return false; } + + ++operationCount; } + if (operationCount == 0) //calling PerformOperations() without anything to do results in E_UNEXPECTED + return true; + //perform actual operations hr = fileOp->PerformOperations(); if (FAILED(hr)) |