-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix platform version for Windows 10/11 using RtlGetVersion()
We've added a new show_platform example to check the reported platform by the base::get_platform() function.
- Loading branch information
Showing
3 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// LAF Library | ||
// Copyright (c) 2024 Igara Studio S.A. | ||
// | ||
// This file is released under the terms of the MIT license. | ||
// Read LICENSE.txt for more information. | ||
|
||
#include "base/platform.h" | ||
|
||
#include <cstdio> | ||
|
||
int app_main(int argc, char* argv[]) | ||
{ | ||
base::Platform p = base::get_platform(); | ||
switch (p.os) { | ||
#if LAF_WINDOWS | ||
case base::Platform::OS::Windows: | ||
std::printf( | ||
"Windows v%s%s%s", | ||
p.osVer.str().c_str(), | ||
p.isWow64 ? " WoW64": "", | ||
(p.wineVer ? (std::string(" WINE v") + p.wineVer).c_str(): "")); | ||
break; | ||
#endif | ||
case base::Platform::OS::macOS: | ||
std::printf( | ||
"macOS v%s", | ||
p.osVer.str().c_str()); | ||
break; | ||
#if LAF_LINUX | ||
case base::Platform::OS::Linux: | ||
std::printf("Linux %s", p.distroName.c_str()); | ||
if (!p.distroVer.empty()) | ||
std::printf(" %s", p.distroVer.c_str()); | ||
break; | ||
#endif | ||
} | ||
switch (p.arch) { | ||
case base::Platform::Arch::x86: | ||
std::printf(" (x86)"); | ||
break; | ||
case base::Platform::Arch::x64: | ||
std::printf(" (x64)"); | ||
break; | ||
case base::Platform::Arch::arm64: | ||
std::printf(" (arm64)"); | ||
break; | ||
} | ||
std::printf("\n"); | ||
return 0; | ||
} |