1
0
Fork 0

OSSupport: Fixed UNICODE Windows builds.

The files now compile even inside UNICODE applications.
This commit is contained in:
Mattes D 2014-09-14 01:28:09 +02:00
parent fdabfd77e2
commit c4a53c5d7d
2 changed files with 8 additions and 8 deletions

View File

@ -298,7 +298,7 @@ bool cFile::Rename(const AString & a_OrigFileName, const AString & a_NewFileName
bool cFile::Copy(const AString & a_SrcFileName, const AString & a_DstFileName)
{
#ifdef _WIN32
return (CopyFile(a_SrcFileName.c_str(), a_DstFileName.c_str(), true) != 0);
return (CopyFileA(a_SrcFileName.c_str(), a_DstFileName.c_str(), true) != 0);
#else
// Other OSs don't have a direct CopyFile equivalent, do it the harder way:
std::ifstream src(a_SrcFileName.c_str(), std::ios::binary);
@ -322,7 +322,7 @@ bool cFile::Copy(const AString & a_SrcFileName, const AString & a_DstFileName)
bool cFile::IsFolder(const AString & a_Path)
{
#ifdef _WIN32
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
DWORD FileAttrib = GetFileAttributesA(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & FILE_ATTRIBUTE_DIRECTORY) != 0));
#else
struct stat st;
@ -337,7 +337,7 @@ bool cFile::IsFolder(const AString & a_Path)
bool cFile::IsFile(const AString & a_Path)
{
#ifdef _WIN32
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
DWORD FileAttrib = GetFileAttributesA(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0));
#else
struct stat st;
@ -366,7 +366,7 @@ int cFile::GetSize(const AString & a_FileName)
bool cFile::CreateFolder(const AString & a_FolderPath)
{
#ifdef _WIN32
return (CreateDirectory(a_FolderPath.c_str(), NULL) != 0);
return (CreateDirectoryA(a_FolderPath.c_str(), NULL) != 0);
#else
return (mkdir(a_FolderPath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0);
#endif
@ -396,13 +396,13 @@ AStringVector cFile::GetFolderContents(const AString & a_Folder)
// Find all files / folders:
FileFilter.append("*.*");
HANDLE hFind;
WIN32_FIND_DATA FindFileData;
if ((hFind = FindFirstFile(FileFilter.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE)
WIN32_FIND_DATAA FindFileData;
if ((hFind = FindFirstFileA(FileFilter.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE)
{
do
{
AllFiles.push_back(FindFileData.cFileName);
} while (FindNextFile(hFind, &FindFileData));
} while (FindNextFileA(hFind, &FindFileData));
FindClose(hFind);
}

View File

@ -69,7 +69,7 @@ protected:
static DWORD __stdcall thrExecute(LPVOID a_Param)
{
// Create a window so that the thread can be identified by 3rd party tools:
HWND IdentificationWnd = CreateWindow("STATIC", ((cIsThread *)a_Param)->m_ThreadName.c_str(), 0, 0, 0, 0, WS_OVERLAPPED, NULL, NULL, NULL, NULL);
HWND IdentificationWnd = CreateWindowA("STATIC", ((cIsThread *)a_Param)->m_ThreadName.c_str(), 0, 0, 0, 0, WS_OVERLAPPED, NULL, NULL, NULL, NULL);
// Run the thread:
((cIsThread *)a_Param)->Execute();