summaryrefslogtreecommitdiff
path: root/shared/IFileOperation/file_op.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:10:11 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:10:11 +0200
commitc0cdb2ad99a1e2a6ade5ce76c91177a79258e669 (patch)
tree4701a015385d9a6a5a4ba99a8f1f5d400fff26b1 /shared/IFileOperation/file_op.cpp
parent3.13 (diff)
downloadFreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.gz
FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.tar.bz2
FreeFileSync-c0cdb2ad99a1e2a6ade5ce76c91177a79258e669.zip
3.14
Diffstat (limited to 'shared/IFileOperation/file_op.cpp')
-rw-r--r--shared/IFileOperation/file_op.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/shared/IFileOperation/file_op.cpp b/shared/IFileOperation/file_op.cpp
index b1b7f4cd..fc942f44 100644
--- a/shared/IFileOperation/file_op.cpp
+++ b/shared/IFileOperation/file_op.cpp
@@ -36,10 +36,10 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[],
// Create the IFileOperation interface
ComPtr<IFileOperation> fileOp;
- hr = CoCreateInstance(CLSID_FileOperation,
- NULL,
- CLSCTX_ALL,
- IID_PPV_ARGS(fileOp.init()));
+ hr = ::CoCreateInstance(CLSID_FileOperation,
+ NULL,
+ CLSCTX_ALL,
+ IID_PPV_ARGS(fileOp.init()));
if (FAILED(hr))
{
lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr);
@@ -70,6 +70,10 @@ bool fileop::moveToRecycleBin(const wchar_t* fileNames[],
IID_PPV_ARGS(psiFile.init()));
if (FAILED(hr))
{
+ if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || //file not existing anymore
+ hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND))
+ continue;
+
std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for file:\n");
message += std::wstring(L"\"") + fileNames[i] + L"\".";
@@ -122,10 +126,10 @@ bool fileop::copyFile(const wchar_t* sourceFile,
// Create the IFileOperation interface
ComPtr<IFileOperation> fileOp;
- hr = CoCreateInstance(CLSID_FileOperation,
- NULL,
- CLSCTX_ALL,
- IID_PPV_ARGS(fileOp.init()));
+ hr = ::CoCreateInstance(CLSID_FileOperation,
+ NULL,
+ CLSCTX_ALL,
+ IID_PPV_ARGS(fileOp.init()));
if (FAILED(hr))
{
lastErrorMessage = generateErrorMsg(L"Error calling \"CoCreateInstance\".", hr);
@@ -148,9 +152,9 @@ bool fileop::copyFile(const wchar_t* sourceFile,
//create source object
ComPtr<IShellItem> psiSourceFile;
- hr = SHCreateItemFromParsingName(sourceFile,
- NULL,
- IID_PPV_ARGS(psiSourceFile.init()));
+ hr = ::SHCreateItemFromParsingName(sourceFile,
+ NULL,
+ IID_PPV_ARGS(psiSourceFile.init()));
if (FAILED(hr))
{
std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for file:\n");
@@ -171,9 +175,9 @@ bool fileop::copyFile(const wchar_t* sourceFile,
//create target folder object
ComPtr<IShellItem> psiTargetFolder;
- hr = SHCreateItemFromParsingName(targetFolder.c_str(),
- NULL,
- IID_PPV_ARGS(psiTargetFolder.init()));
+ hr = ::SHCreateItemFromParsingName(targetFolder.c_str(),
+ NULL,
+ IID_PPV_ARGS(psiTargetFolder.init()));
if (FAILED(hr))
{
std::wstring message(L"Error calling \"SHCreateItemFromParsingName\" for folder:\n");
bgstack15