Qt 5.12 deprecation fixes (#1003)
This commit is contained in:
@@ -426,16 +426,6 @@ std::wstring FilePath::wstr() const
|
||||
return m_path->generic_wstring();
|
||||
}
|
||||
|
||||
std::string FilePath::getBackslashedString() const
|
||||
{
|
||||
return utility::replace(str(), "/", "\\");
|
||||
}
|
||||
|
||||
std::wstring FilePath::getBackslashedWString() const
|
||||
{
|
||||
return utility::replace(wstr(), L"/", L"\\");
|
||||
}
|
||||
|
||||
std::wstring FilePath::fileName() const
|
||||
{
|
||||
return m_path->filename().generic_wstring();
|
||||
|
||||
@@ -52,8 +52,6 @@ public:
|
||||
|
||||
std::string str() const;
|
||||
std::wstring wstr() const;
|
||||
std::string getBackslashedString() const;
|
||||
std::wstring getBackslashedWString() const;
|
||||
std::wstring fileName() const;
|
||||
|
||||
std::wstring extension() const;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef UTILITY_LIBRARY_H
|
||||
#define UTILITY_LIBRARY_H
|
||||
|
||||
#include <QDir>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -23,8 +24,8 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
|
||||
const FilePath& libraryPath, const std::string& functionName, std::string& errorString)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const std::string libraryPathString = libraryPath.getBackslashedString();
|
||||
HINSTANCE handle = LoadLibrary(libraryPathString.c_str());
|
||||
QString libraryPathString = QDir::toNativeSeparators(QString::fromStdWString(libraryPath.wstr()));
|
||||
HINSTANCE handle = LoadLibrary(libraryPathString.toStdString().c_str());
|
||||
if (handle == nullptr)
|
||||
{
|
||||
DWORD errorCode = GetLastError();
|
||||
@@ -53,8 +54,8 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
|
||||
|
||||
LocalFree(messageBuffer);
|
||||
|
||||
errorString = "Could not load library \"" + libraryPathString + "\" because of " +
|
||||
errorReasonString;
|
||||
errorString = "Could not load library \"" + libraryPathString.toStdString() +
|
||||
"\" because of " + errorReasonString;
|
||||
return std::function<Ret(Args...)>();
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
|
||||
if (!functionId)
|
||||
{
|
||||
errorString = "Could not locate the function \"" + functionName + "\" in library\"" +
|
||||
libraryPathString + "\"";
|
||||
libraryPathString.toStdString() + "\"";
|
||||
return std::function<Ret(Args...)>();
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user