From dcfa80813d8acfef218069a56774cc378729d391 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Mon, 14 Feb 2022 09:52:48 -0500 Subject: [PATCH 1/5] Added system architecture to `winget --info`. --- src/AppInstallerCLICore/Commands/RootCommand.cpp | 2 ++ src/AppInstallerCLICore/Resources.h | 1 + src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp index ecc608bed4..965377cedf 100644 --- a/src/AppInstallerCLICore/Commands/RootCommand.cpp +++ b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -173,6 +173,8 @@ namespace AppInstaller::CLI info << std::endl << "Windows: "_liv << Runtime::GetOSVersion() << std::endl; + info << Resource::String::Architecture << ": "_liv << Utility::ToString(Utility::GetSystemArchitecture()) << std::endl; + if (Runtime::IsRunningInPackagedContext()) { info << Resource::String::Package << ": "_liv << Runtime::GetPackageVersion() << std::endl; diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h index 9fa6921885..e91371ddfe 100644 --- a/src/AppInstallerCLICore/Resources.h +++ b/src/AppInstallerCLICore/Resources.h @@ -27,6 +27,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingDisableDescription); WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingEnabled); WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingEnableDescription); + WINGET_DEFINE_RESOURCE_STRINGID(Architecture); WINGET_DEFINE_RESOURCE_STRINGID(AvailableArguments); WINGET_DEFINE_RESOURCE_STRINGID(AvailableCommands); WINGET_DEFINE_RESOURCE_STRINGID(AvailableHeader); diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw index cced9e4e1d..f278dae472 100644 --- a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw +++ b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1272,4 +1272,7 @@ Please specify one of them using the `--source` option to proceed. The arguments provided can only be used with a query. + + Architecture + \ No newline at end of file From 431ece13bf22bc70ff5ea4baacc75720bc717eeb Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Mon, 14 Feb 2022 11:03:31 -0600 Subject: [PATCH 2/5] =?UTF-8?q?@JohnMcPMS=20made=20a=20string=20correction?= =?UTF-8?q?!=20It=E2=80=99s=20super=20effective!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: JohnMcPMS --- src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw index f278dae472..2fa62a454a 100644 --- a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw +++ b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1273,6 +1273,6 @@ Please specify one of them using the `--source` option to proceed. The arguments provided can only be used with a query. - Architecture + System Architecture \ No newline at end of file From d9aa0b76d046d24d317d09400efcf60dc9624834 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Thu, 17 Feb 2022 10:59:36 -0500 Subject: [PATCH 3/5] Changed variable and made the Architecture string LocIndView. --- src/AppInstallerCLICore/Commands/RootCommand.cpp | 2 +- src/AppInstallerCLICore/Resources.h | 2 +- src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp index 965377cedf..436631bb23 100644 --- a/src/AppInstallerCLICore/Commands/RootCommand.cpp +++ b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -173,7 +173,7 @@ namespace AppInstaller::CLI info << std::endl << "Windows: "_liv << Runtime::GetOSVersion() << std::endl; - info << Resource::String::Architecture << ": "_liv << Utility::ToString(Utility::GetSystemArchitecture()) << std::endl; + info << Resource::String::SystemArchitecture << ": "_liv << Utility::LocIndView(Utility::ToString(Utility::GetSystemArchitecture())) << std::endl; if (Runtime::IsRunningInPackagedContext()) { diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h index e91371ddfe..5f355bdf8e 100644 --- a/src/AppInstallerCLICore/Resources.h +++ b/src/AppInstallerCLICore/Resources.h @@ -27,7 +27,6 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingDisableDescription); WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingEnabled); WINGET_DEFINE_RESOURCE_STRINGID(AdminSettingEnableDescription); - WINGET_DEFINE_RESOURCE_STRINGID(Architecture); WINGET_DEFINE_RESOURCE_STRINGID(AvailableArguments); WINGET_DEFINE_RESOURCE_STRINGID(AvailableCommands); WINGET_DEFINE_RESOURCE_STRINGID(AvailableHeader); @@ -319,6 +318,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateCommandLongDescription); WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateCommandShortDescription); WINGET_DEFINE_RESOURCE_STRINGID(SourceUpdateOne); + WINGET_DEFINE_RESOURCE_STRINGID(SystemArchitecture); WINGET_DEFINE_RESOURCE_STRINGID(TagArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(ThankYou); WINGET_DEFINE_RESOURCE_STRINGID(ThirdPartSoftwareNotices); diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw index 2fa62a454a..47239ab436 100644 --- a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw +++ b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1272,7 +1272,7 @@ Please specify one of them using the `--source` option to proceed. The arguments provided can only be used with a query. - + System Architecture \ No newline at end of file From a8f0dd753f6dbf24f4b6246491871145c3d6f247 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Fri, 18 Feb 2022 11:14:38 -0500 Subject: [PATCH 4/5] Fixed LocIndView typing for Architecuter (thanks @yao-msft!). --- src/AppInstallerCLICore/Commands/RootCommand.cpp | 2 +- src/AppInstallerCommonCore/Architecture.cpp | 14 +++++++------- .../Public/AppInstallerArchitecture.h | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp index 436631bb23..098878d6fa 100644 --- a/src/AppInstallerCLICore/Commands/RootCommand.cpp +++ b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -173,7 +173,7 @@ namespace AppInstaller::CLI info << std::endl << "Windows: "_liv << Runtime::GetOSVersion() << std::endl; - info << Resource::String::SystemArchitecture << ": "_liv << Utility::LocIndView(Utility::ToString(Utility::GetSystemArchitecture())) << std::endl; + info << Resource::String::SystemArchitecture << ": "_liv << Utility::ToString(Utility::GetSystemArchitecture()) << std::endl; if (Runtime::IsRunningInPackagedContext()) { diff --git a/src/AppInstallerCommonCore/Architecture.cpp b/src/AppInstallerCommonCore/Architecture.cpp index 2e40069dcc..f9a0afbd3c 100644 --- a/src/AppInstallerCommonCore/Architecture.cpp +++ b/src/AppInstallerCommonCore/Architecture.cpp @@ -186,23 +186,23 @@ namespace AppInstaller::Utility return Architecture::Unknown; } - std::string_view ToString(Architecture architecture) + LocIndView ToString(Architecture architecture) { switch (architecture) { case Architecture::Neutral: - return "Neutral"sv; + return LocIndView("Neutral"sv); case Architecture::X86: - return "X86"sv; + return LocIndView("X86"sv); case Architecture::X64: - return "X64"sv; + return LocIndView("X64"sv); case Architecture::Arm: - return "Arm"sv; + return LocIndView("Arm"sv); case Architecture::Arm64: - return "Arm64"sv; + return LocIndView("Arm64"sv); } - return "Unknown"sv; + return LocIndView("Unknown"sv); } Architecture GetSystemArchitecture() diff --git a/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h b/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h index c25bb54458..5e20cf14e2 100644 --- a/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h +++ b/src/AppInstallerCommonCore/Public/AppInstallerArchitecture.h @@ -3,6 +3,7 @@ #pragma once #include +#include namespace AppInstaller::Utility { @@ -22,7 +23,7 @@ namespace AppInstaller::Utility Architecture ConvertToArchitectureEnum(const std::string& archStr); // Converts an Architecture to a string_view - std::string_view ToString(Architecture architecture); + LocIndView ToString(Architecture architecture); // Gets the system's architecture as Architecture enum AppInstaller::Utility::Architecture GetSystemArchitecture(); From b2fc2172a0a79f00ffefe11c404032fc94828f08 Mon Sep 17 00:00:00 2001 From: Easton Pillay Date: Mon, 21 Feb 2022 09:09:41 -0500 Subject: [PATCH 5/5] =?UTF-8?q?Changed=20to=20use=20literals=20?= =?UTF-8?q?=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppInstallerCommonCore/Architecture.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/AppInstallerCommonCore/Architecture.cpp b/src/AppInstallerCommonCore/Architecture.cpp index f9a0afbd3c..93d1fe8a34 100644 --- a/src/AppInstallerCommonCore/Architecture.cpp +++ b/src/AppInstallerCommonCore/Architecture.cpp @@ -8,6 +8,7 @@ namespace AppInstaller::Utility { + using namespace literals; namespace { // IsWow64GuestMachineSupported() is available starting on Windows 10, version 1709 (RS3). @@ -191,18 +192,18 @@ namespace AppInstaller::Utility switch (architecture) { case Architecture::Neutral: - return LocIndView("Neutral"sv); + return "Neutral"_liv; case Architecture::X86: - return LocIndView("X86"sv); + return "X86"_liv; case Architecture::X64: - return LocIndView("X64"sv); + return "X64"_liv; case Architecture::Arm: - return LocIndView("Arm"sv); + return "Arm"_liv; case Architecture::Arm64: - return LocIndView("Arm64"sv); + return "Arm64"_liv; } - return LocIndView("Unknown"sv); + return "Unknown"_liv; } Architecture GetSystemArchitecture()