proper fix for issue #1041
This commit is contained in:
+5
-4
@@ -5,6 +5,7 @@
|
|||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include "rFile.h"
|
#include "rFile.h"
|
||||||
|
#include "errno.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
@@ -25,7 +26,7 @@ std::wstring ConvertUTF8ToWString(const std::string &source) {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define GET_API_ERROR GetLastError()
|
#define GET_API_ERROR GetLastError()
|
||||||
#else
|
#else
|
||||||
#define GET_API_ERROR err
|
#define GET_API_ERROR errno
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool getFileInfo(const char *path, FileInfo *fileInfo) {
|
bool getFileInfo(const char *path, FileInfo *fileInfo) {
|
||||||
@@ -112,7 +113,7 @@ bool rRmdir(const std::string &dir)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str()))
|
if (!RemoveDirectory(ConvertUTF8ToWString(dir).c_str()))
|
||||||
#else
|
#else
|
||||||
if (int err = rmdir(dir.c_str()))
|
if (rmdir(dir.c_str()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "Error deleting directory %s: 0x%llx", dir.c_str(), (u64)GET_API_ERROR);
|
LOG_ERROR(GENERAL, "Error deleting directory %s: 0x%llx", dir.c_str(), (u64)GET_API_ERROR);
|
||||||
@@ -127,7 +128,7 @@ bool rRename(const std::string &from, const std::string &to)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!MoveFile(ConvertUTF8ToWString(from).c_str(), ConvertUTF8ToWString(to).c_str()))
|
if (!MoveFile(ConvertUTF8ToWString(from).c_str(), ConvertUTF8ToWString(to).c_str()))
|
||||||
#else
|
#else
|
||||||
if (int err = rename(from.c_str(), to.c_str()))
|
if (rename(from.c_str(), to.c_str()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "Error renaming '%s' to '%s': 0x%llx", from.c_str(), to.c_str(), (u64)GET_API_ERROR);
|
LOG_ERROR(GENERAL, "Error renaming '%s' to '%s': 0x%llx", from.c_str(), to.c_str(), (u64)GET_API_ERROR);
|
||||||
@@ -152,7 +153,7 @@ bool rRemoveFile(const std::string &file)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!DeleteFile(ConvertUTF8ToWString(file).c_str()))
|
if (!DeleteFile(ConvertUTF8ToWString(file).c_str()))
|
||||||
#else
|
#else
|
||||||
if (int err = unlink(file.c_str()))
|
if (unlink(file.c_str()))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "Error deleting file %s: 0x%llx", file.c_str(), (u64)GET_API_ERROR);
|
LOG_ERROR(GENERAL, "Error deleting file %s: 0x%llx", file.c_str(), (u64)GET_API_ERROR);
|
||||||
|
|||||||
Reference in New Issue
Block a user