Change in Windows 7 Implementation

This commit is contained in:
Ruben Guerrero Samaniego 2018-04-18 09:35:41 -07:00 коммит произвёл msftrubengu
Родитель 7cfc496e2f
Коммит 3808542355
2 изменённых файлов: 37 добавлений и 34 удалений

Просмотреть файл

@ -166,35 +166,35 @@ ENDIF()
IF((MACOS) OR (IOS))
if ((CMAKE_BUILD_TYPE MATCHES Release) OR (CMAKE_BUILD_TYPE MATCHES MinSizeRel))
MESSAGE (STATUS "optimized build, symbol generation turned-OFF" )
# on optimized builds, do NOT turn-on symbol generation.
else()
MESSAGE (STATUS "non-optimized build, symbol generation turned-ON" )
# Incredibly, for both clang and g++, while a single compile-and-link
# invocation will create an executable.dSYM/ dir with debug info,
# with separate compilation the final link does NOT create the
# dSYM dir.
# The "dsymutil" program will create the dSYM dir for us.
# Strangely it takes in the executable and not the object
# files even though it's the latter that contain the debug info.
# Thus it will only work if the object files are still sitting around.
find_program(DSYMUTIL_PROGRAM dsymutil)
if (DSYMUTIL_PROGRAM)
set(CMAKE_C_LINK_EXECUTABLE
"${CMAKE_C_LINK_EXECUTABLE}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_C_CREATE_SHARED_LIBRARY
"${CMAKE_C_CREATE_SHARED_LIBRARY}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE
"${CMAKE_CXX_LINK_EXECUTABLE}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
"${DSYMUTIL_PROGRAM} <TARGET>")
endif ()
endif()
if ((CMAKE_BUILD_TYPE MATCHES Release) OR (CMAKE_BUILD_TYPE MATCHES MinSizeRel))
MESSAGE (STATUS "optimized build, symbol generation turned-OFF" )
# on optimized builds, do NOT turn-on symbol generation.
else()
MESSAGE (STATUS "non-optimized build, symbol generation turned-ON" )
# Incredibly, for both clang and g++, while a single compile-and-link
# invocation will create an executable.dSYM/ dir with debug info,
# with separate compilation the final link does NOT create the
# dSYM dir.
# The "dsymutil" program will create the dSYM dir for us.
# Strangely it takes in the executable and not the object
# files even though it's the latter that contain the debug info.
# Thus it will only work if the object files are still sitting around.
find_program(DSYMUTIL_PROGRAM dsymutil)
if (DSYMUTIL_PROGRAM)
set(CMAKE_C_LINK_EXECUTABLE
"${CMAKE_C_LINK_EXECUTABLE}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_C_CREATE_SHARED_LIBRARY
"${CMAKE_C_CREATE_SHARED_LIBRARY}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE
"${CMAKE_CXX_LINK_EXECUTABLE}"
"${DSYMUTIL_PROGRAM} <TARGET>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
"${DSYMUTIL_PROGRAM} <TARGET>")
endif ()
endif()
ENDIF()
enable_testing() # needed on top-level CMakeLists.txt

Просмотреть файл

@ -15,6 +15,7 @@
#include <set>
#include <map>
#include <iostream>
using namespace ABI::Windows::Foundation::Collections;
using namespace ABI::Windows::System::UserProfile;
@ -110,13 +111,13 @@ namespace MSIX {
ThrowHrIfFalse(GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numOfLangs, &languagesWin7.front(), &size),
"Failed GetUserPreferredUILanguages");
std::wistringstream tokenStream(languagesWin7);
wchar_t delimiter = '\0';
size_t position = 0;
ULONG processedTags = 0;
std::wstring muiTag;
while (std::getline(tokenStream, muiTag, delimiter))
wchar_t delimiter = '\0';
auto found = languagesWin7.find(delimiter);
while(found != std::string::npos && processedTags < numOfLangs)
{
if (processedTags == numOfLangs) { break; }
auto muiTag = languagesWin7.substr(position, found - position);
auto it = muiToBcp47.find(muiTag);
if (it != muiToBcp47.end())
{
@ -126,7 +127,9 @@ namespace MSIX {
{ // Is not well known, luckily the tag will be the same (probably not) :)
result.insert(utf16_to_utf8(muiTag));
}
position = found+1;
processedTags++;
found = languagesWin7.find(delimiter, position);
}
}
else