OSSupport: Fixed UNICODE Windows builds.
The files now compile even inside UNICODE applications.
This commit is contained in:
parent
fdabfd77e2
commit
c4a53c5d7d
@ -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)
|
bool cFile::Copy(const AString & a_SrcFileName, const AString & a_DstFileName)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#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
|
#else
|
||||||
// Other OSs don't have a direct CopyFile equivalent, do it the harder way:
|
// Other OSs don't have a direct CopyFile equivalent, do it the harder way:
|
||||||
std::ifstream src(a_SrcFileName.c_str(), std::ios::binary);
|
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)
|
bool cFile::IsFolder(const AString & a_Path)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#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));
|
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & FILE_ATTRIBUTE_DIRECTORY) != 0));
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -337,7 +337,7 @@ bool cFile::IsFolder(const AString & a_Path)
|
|||||||
bool cFile::IsFile(const AString & a_Path)
|
bool cFile::IsFile(const AString & a_Path)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#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));
|
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0));
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -366,7 +366,7 @@ int cFile::GetSize(const AString & a_FileName)
|
|||||||
bool cFile::CreateFolder(const AString & a_FolderPath)
|
bool cFile::CreateFolder(const AString & a_FolderPath)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (CreateDirectory(a_FolderPath.c_str(), NULL) != 0);
|
return (CreateDirectoryA(a_FolderPath.c_str(), NULL) != 0);
|
||||||
#else
|
#else
|
||||||
return (mkdir(a_FolderPath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0);
|
return (mkdir(a_FolderPath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0);
|
||||||
#endif
|
#endif
|
||||||
@ -396,13 +396,13 @@ AStringVector cFile::GetFolderContents(const AString & a_Folder)
|
|||||||
// Find all files / folders:
|
// Find all files / folders:
|
||||||
FileFilter.append("*.*");
|
FileFilter.append("*.*");
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
WIN32_FIND_DATA FindFileData;
|
WIN32_FIND_DATAA FindFileData;
|
||||||
if ((hFind = FindFirstFile(FileFilter.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE)
|
if ((hFind = FindFirstFileA(FileFilter.c_str(), &FindFileData)) != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
AllFiles.push_back(FindFileData.cFileName);
|
AllFiles.push_back(FindFileData.cFileName);
|
||||||
} while (FindNextFile(hFind, &FindFileData));
|
} while (FindNextFileA(hFind, &FindFileData));
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ protected:
|
|||||||
static DWORD __stdcall thrExecute(LPVOID a_Param)
|
static DWORD __stdcall thrExecute(LPVOID a_Param)
|
||||||
{
|
{
|
||||||
// Create a window so that the thread can be identified by 3rd party tools:
|
// 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:
|
// Run the thread:
|
||||||
((cIsThread *)a_Param)->Execute();
|
((cIsThread *)a_Param)->Execute();
|
||||||
|
Loading…
Reference in New Issue
Block a user