commit ed746269
Changed the utf-16 to utf-8 to be in namespace sago::internal, so that it can be tested independently.
Changed files
| M | sago/platform_folders.cpp before |
| M | sago/platform_folders.h before |
diff --git a/sago/platform_folders.cpp b/sago/platform_folders.cpp
index 1c9b99c..c797177 100644
--- a/sago/platform_folders.cpp
+++ b/sago/platform_folders.cpp
@@ -80,6 +80,9 @@ static std::string getHome() {
// For SHGetFolderPathW and various CSIDL "magic numbers"
#include <shlobj.h>
+namespace sago {
+namespace internal {
+
static std::string win32_utf16_to_utf8(const wchar_t* wstr) {
std::string res;
// If the 6th parameter is 0 then WideCharToMultiByte returns the number of bytes needed to store the result.
@@ -98,6 +101,9 @@ static std::string win32_utf16_to_utf8(const wchar_t* wstr) {
return res;
}
+} // namesapce internal
+} // namespace sago
+
class FreeCoTaskMemory {
LPWSTR pointer = NULL;
public:
@@ -116,7 +122,7 @@ static std::string GetKnownWindowsFolder(REFKNOWNFOLDERID folderId, const char*
if (!SUCCEEDED(hr)) {
throw std::runtime_error(errorMsg);
}
- return win32_utf16_to_utf8(wszPath);
+ return sago::internal::win32_utf16_to_utf8(wszPath);
}
static std::string GetAppData() {
diff --git a/sago/platform_folders.h b/sago/platform_folders.h
index fc9dd3b..a9a6477 100644
--- a/sago/platform_folders.h
+++ b/sago/platform_folders.h
@@ -42,6 +42,9 @@ namespace internal {
#if !defined(_WIN32) && !defined(__APPLE__)
void appendExtraFoldersTokenizer(const char* envName, const char* envValue, std::vector<std::string>& folders);
#endif
+ #ifdef _WIN32
+ std::string win32_utf16_to_utf8(const wchar_t* wstr);
+ #endif
}
#endif //DOXYGEN_SHOULD_SKIP_THIS