2021-10-04 08:33:23 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2014 - 2021 Symless Ltd.
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2021-10-04 08:33:23 +00:00
|
|
|
*/
|
2025-01-24 00:11:17 +00:00
|
|
|
|
2021-10-04 08:33:23 +00:00
|
|
|
#include "Path.h"
|
|
|
|
|
|
|
|
|
|
#if SYSAPI_WIN32
|
|
|
|
|
#include "arch/win32/ArchMiscWindows.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
namespace deskflow {
|
2021-10-04 08:33:23 +00:00
|
|
|
|
|
|
|
|
namespace filesystem {
|
|
|
|
|
|
|
|
|
|
#ifdef SYSAPI_WIN32
|
|
|
|
|
|
2025-01-06 00:55:07 +00:00
|
|
|
std::wstring path(const std::string &filePath)
|
2024-10-17 18:04:35 +00:00
|
|
|
{
|
2024-07-02 19:07:06 +00:00
|
|
|
std::wstring result;
|
|
|
|
|
|
2025-04-27 19:39:23 +00:00
|
|
|
auto length = MultiByteToWideChar(CP_UTF8, 0, filePath.c_str(), static_cast<int>(filePath.length()), nullptr, 0);
|
2024-08-07 17:11:29 +00:00
|
|
|
if (length > 0) {
|
|
|
|
|
result.resize(length);
|
2024-10-17 18:04:35 +00:00
|
|
|
MultiByteToWideChar(CP_UTF8, 0, filePath.c_str(), static_cast<int>(filePath.length()), &result[0], length);
|
2024-07-02 19:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
2021-10-04 08:33:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
2025-01-06 00:55:07 +00:00
|
|
|
std::string path(const std::string &filePath)
|
2024-10-17 18:04:35 +00:00
|
|
|
{
|
|
|
|
|
return filePath;
|
|
|
|
|
}
|
2021-10-04 08:33:23 +00:00
|
|
|
#endif
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
} // namespace filesystem
|
2021-10-04 08:33:23 +00:00
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
} // namespace deskflow
|