GUI: Fix building with MinGW.
Add shlwapi library to qmake project file. Use WCHAR instead of wchar_t.
This commit is contained in:
parent
55acefa206
commit
997872f624
|
@ -11,6 +11,7 @@ OBJECTS_DIR = temp
|
||||||
CONFIG += warn_on debug
|
CONFIG += warn_on debug
|
||||||
RESOURCES = gui.qrc
|
RESOURCES = gui.qrc
|
||||||
RC_FILE = cppcheck-gui.rc
|
RC_FILE = cppcheck-gui.rc
|
||||||
|
win32:LIBS += -lshlwapi
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
|
#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#pragma comment(lib, "shlwapi.lib")
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string FileLister::simplifyPath(const char *originalPath)
|
std::string FileLister::simplifyPath(const char *originalPath)
|
||||||
|
@ -175,9 +174,9 @@ static bool TransformAnsiToUcs2(LPCSTR psAnsi, LPWSTR psUcs, UINT nUcs)
|
||||||
|
|
||||||
static BOOL MyIsDirectory(std::string path)
|
static BOOL MyIsDirectory(std::string path)
|
||||||
{
|
{
|
||||||
wchar_t * unicodeCleanPath = new wchar_t[path.size() + 1];
|
WCHAR * unicodeCleanPath = new WCHAR[path.size() + 1];
|
||||||
TransformAnsiToUcs2(path.c_str(), unicodeCleanPath,
|
TransformAnsiToUcs2(path.c_str(), unicodeCleanPath,
|
||||||
(path.size() * sizeof wchar_t) + 1);
|
(path.size() * sizeof(WCHAR)) + 1);
|
||||||
// See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
|
// See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
|
||||||
BOOL res = PathIsDirectory(unicodeCleanPath);
|
BOOL res = PathIsDirectory(unicodeCleanPath);
|
||||||
delete [] unicodeCleanPath;
|
delete [] unicodeCleanPath;
|
||||||
|
@ -186,8 +185,8 @@ static BOOL MyIsDirectory(std::string path)
|
||||||
|
|
||||||
static HANDLE MyFindFirstFile(std::string path, LPWIN32_FIND_DATA findData)
|
static HANDLE MyFindFirstFile(std::string path, LPWIN32_FIND_DATA findData)
|
||||||
{
|
{
|
||||||
wchar_t * unicodeOss = new wchar_t[path.size() + 1];
|
WCHAR * unicodeOss = new wchar_t[path.size() + 1];
|
||||||
TransformAnsiToUcs2(path.c_str(), unicodeOss, (path.size() + 1) * sizeof wchar_t);
|
TransformAnsiToUcs2(path.c_str(), unicodeOss, (path.size() + 1) * sizeof(WCHAR));
|
||||||
HANDLE hFind = FindFirstFile(unicodeOss, findData);
|
HANDLE hFind = FindFirstFile(unicodeOss, findData);
|
||||||
delete [] unicodeOss;
|
delete [] unicodeOss;
|
||||||
return hFind;
|
return hFind;
|
||||||
|
|
Loading…
Reference in New Issue