Skip to content

Commit 4201acc

Browse files
committed
Minor fix to CLI11 to support UWP builds.
Specifically, CommandLineToArgvW is not available for UWP, so replaced it with __argc and __argv directly.
1 parent eadef60 commit 4201acc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/CLI11.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,19 @@ CLI11_INLINE std::vector<std::string> compute_win32_argv();
434434
namespace detail {
435435

436436
#ifdef _WIN32
437+
#ifdef WINAPI_FAMILY
438+
#if WINAPI_FAMILY == WINAPI_FAMILY_APP // window store app
439+
CLI11_INLINE std::vector<std::string> compute_win32_argv() {
440+
std::vector<std::string> result;
441+
442+
result.reserve(static_cast<size_t>(__argc));
443+
for(size_t i = 0; i < static_cast<size_t>(__argc); ++i) {
444+
result.push_back(std::string(__argv[i]));
445+
}
446+
447+
return result;
448+
}
449+
#else
437450
CLI11_INLINE std::vector<std::string> compute_win32_argv() {
438451
std::vector<std::string> result;
439452
int argc = 0;
@@ -454,6 +467,8 @@ CLI11_INLINE std::vector<std::string> compute_win32_argv() {
454467

455468
return result;
456469
}
470+
#endif
471+
#endif
457472
#endif
458473

459474
} // namespace detail

0 commit comments

Comments
 (0)