refactor: base/Path use QString to convert to WString fo windows
This commit is contained in:
parent
7d07222832
commit
78234f60c4
1 changed files with 3 additions and 10 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Path.h"
|
#include "Path.h"
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
#include "arch/win32/ArchMiscWindows.h"
|
#include <QString>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace deskflow::filesystem {
|
namespace deskflow::filesystem {
|
||||||
|
|
@ -16,15 +16,8 @@ namespace deskflow::filesystem {
|
||||||
|
|
||||||
std::wstring path(const std::string &filePath)
|
std::wstring path(const std::string &filePath)
|
||||||
{
|
{
|
||||||
std::wstring result;
|
const auto qstring = QString::fromStdString(filePath);
|
||||||
|
return qstring.toStdWString();
|
||||||
auto length = MultiByteToWideChar(CP_UTF8, 0, filePath.c_str(), static_cast<int>(filePath.length()), nullptr, 0);
|
|
||||||
if (length > 0) {
|
|
||||||
result.resize(length);
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, filePath.c_str(), static_cast<int>(filePath.length()), &result[0], length);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue