deskflow/src/lib/base/Path.cpp
2025-06-20 09:39:26 +01:00

38 lines
820 B
C++

/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2014 - 2021 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "Path.h"
#if SYSAPI_WIN32
#include "arch/win32/ArchMiscWindows.h"
#endif
namespace deskflow::filesystem {
#ifdef SYSAPI_WIN32
std::wstring path(const std::string &filePath)
{
std::wstring result;
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
std::string path(const std::string &filePath)
{
return filePath;
}
#endif
} // namespace deskflow::filesystem