diff options
Diffstat (limited to 'shared/IFileOperation/file_op.cpp')
-rw-r--r-- | shared/IFileOperation/file_op.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/shared/IFileOperation/file_op.cpp b/shared/IFileOperation/file_op.cpp index f37a2e66..6180a561 100644 --- a/shared/IFileOperation/file_op.cpp +++ b/shared/IFileOperation/file_op.cpp @@ -7,37 +7,31 @@ #include "file_op.h" #include "../com_ptr.h" #include "../com_error.h" +#include "../c_dll.h" -#define WIN32_LEAN_AND_MEAN -#include "windows.h" #include <Shellapi.h> // Included for shell constants such as FO_* values #include <shobjidl.h> // Required for necessary shell dependencies - +#include <comdef.h> #include <algorithm> #include <string> #include <cstdio> -#include <comdef.h> - +#define WIN32_LEAN_AND_MEAN +#include "windows.h" -void writeString(const std::wstring& input, wchar_t* output, size_t outputBufferLen) -{ - const size_t newSize = min(input.length() + 1, outputBufferLen); //including null-termination - memcpy(output, input.c_str(), newSize * sizeof(wchar_t)); - output[newSize-1] = 0; //if output buffer is too small... -} +using namespace c_dll; -namespace FileOp +namespace fileop { std::wstring lastErrorMessage; } -bool FileOp::moveToRecycleBin(const wchar_t* fileNames[], +bool fileop::moveToRecycleBin(const wchar_t* fileNames[], size_t fileNo) //size of fileNames array { - using Util::ComPtr; - using Util::generateErrorMsg; + using util::ComPtr; + using util::generateErrorMsg; HRESULT hr; // Create the IFileOperation interface @@ -117,11 +111,11 @@ bool FileOp::moveToRecycleBin(const wchar_t* fileNames[], } -bool FileOp::copyFile(const wchar_t* sourceFile, +bool fileop::copyFile(const wchar_t* sourceFile, const wchar_t* targetFile) { - using Util::ComPtr; - using Util::generateErrorMsg; + using util::ComPtr; + using util::generateErrorMsg; HRESULT hr; @@ -223,7 +217,7 @@ bool FileOp::copyFile(const wchar_t* sourceFile, //if any of the functions above returns 'false', this message returns last error -void FileOp::getLastError(wchar_t* errorMessage, size_t errorBufferLen) +void fileop::getLastError(wchar_t* errorMessage, size_t errorBufferLen) { writeString(lastErrorMessage, errorMessage, errorBufferLen); } |