diff options
author | B Stack <bgstack15@gmail.com> | 2020-04-18 12:59:51 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-04-18 12:59:51 -0400 |
commit | fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0 (patch) | |
tree | 8cfcea5441be72ad92095a3887ded84d38f9ba11 /zen/recycler.cpp | |
parent | Merge branch '10.22' into 'master' (diff) | |
download | FreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.tar.gz FreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.tar.bz2 FreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.zip |
add upstream 10.23
Diffstat (limited to 'zen/recycler.cpp')
-rw-r--r-- | zen/recycler.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/zen/recycler.cpp b/zen/recycler.cpp index f4fd870b..4d6ea1fd 100644 --- a/zen/recycler.cpp +++ b/zen/recycler.cpp @@ -31,12 +31,8 @@ bool zen::recycleOrDeleteIfExists(const Zstring& itemPath) //throw FileError if (!type) return false; - const std::wstring errorMsg = replaceCpy(_("Unable to move %x to the recycle bin."), L"%x", fmtPath(itemPath)); - if (!error) - throw FileError(errorMsg, L"g_file_trash: unknown error."); //user should never see this - //implement same behavior as in Windows: if recycler is not existing, delete permanently - if (error->code == G_IO_ERROR_NOT_SUPPORTED) + if (error && error->code == G_IO_ERROR_NOT_SUPPORTED) { if (*type == ItemType::FOLDER) removeDirectoryPlainRecursion(itemPath); //throw FileError @@ -45,9 +41,10 @@ bool zen::recycleOrDeleteIfExists(const Zstring& itemPath) //throw FileError return true; } - throw FileError(errorMsg, formatSystemError(L"g_file_trash", - replaceCpy(_("Error Code %x"), L"%x", numberTo<std::wstring>(error->code)), - utfTo<std::wstring>(error->message))); + throw FileError(replaceCpy(_("Unable to move %x to the recycle bin."), L"%x", fmtPath(itemPath)), + formatSystemError("g_file_trash", + error ? replaceCpy(_("Error code %x"), L"%x", numberTo<std::wstring>(error->code)) : L"", + error ? utfTo<std::wstring>(error->message) : L"Unknown error.")); //g_quark_to_string(error->domain) } return true; |