Add function winpr_MoveFileEx
This commit is contained in:
parent
6e7b91c5ad
commit
22dce52d15
@ -336,6 +336,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
WINPR_API BOOL winpr_MoveFile(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
|
||||
WINPR_API BOOL winpr_MoveFileEx(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags);
|
||||
WINPR_API BOOL winpr_DeleteFile(const char* lpFileName);
|
||||
WINPR_API BOOL winpr_RemoveDirectory(LPCSTR lpPathName);
|
||||
WINPR_API BOOL winpr_PathFileExists(const char* pszPath);
|
||||
|
@ -689,6 +689,33 @@ cleanup:
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL winpr_MoveFileEx(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags);
|
||||
#else
|
||||
BOOL result = FALSE;
|
||||
LPWSTR lpExistingFileNameW = NULL;
|
||||
LPWSTR lpNewFileNameW = NULL;
|
||||
|
||||
if (!lpExistingFileName || !lpNewFileName)
|
||||
return FALSE;
|
||||
|
||||
if (ConvertToUnicode(CP_UTF8, 0, lpExistingFileName, -1, &lpExistingFileNameW, 0) < 1)
|
||||
goto cleanup;
|
||||
|
||||
if (ConvertToUnicode(CP_UTF8, 0, lpNewFileName, -1, &lpNewFileNameW, 0) < 1)
|
||||
goto cleanup;
|
||||
|
||||
result = MoveFileExW(lpExistingFileNameW, lpNewFileNameW, dwFlags);
|
||||
|
||||
cleanup:
|
||||
free(lpExistingFileNameW);
|
||||
free(lpNewFileNameW);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL winpr_DeleteFile(const char* lpFileName)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user