Skip to content

Commit

Permalink
Add configuration modules path to '--info' (#5023)
Browse files Browse the repository at this point in the history
<!-- To check a checkbox place an "x" between the brackets. e.g: [x] -->

- [x] I have signed the [Contributor License
Agreement](https://cla.opensource.microsoft.com/microsoft/winget-pkgs).
- [ ] This pull request is related to an issue.


Adds the WinGet configuration modules location to `--info` table


-----

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/5023)
  • Loading branch information
mdanish-kh authored Dec 10, 2024
1 parent 09a9808 commit df6a13a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Commands/RootCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ namespace AppInstaller::CLI
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableRoot }, Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRoot, true).u8string() });
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableRoot86 }, Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRootX86, true).u8string() });
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::InstallerDownloads }, Runtime::GetPathTo(Runtime::PathName::UserProfileDownloads, true).u8string() });
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::ConfigurationModules }, Runtime::GetPathTo(Runtime::PathName::ConfigurationModules, true).u8string() });
keyDirectories.Complete();
context.Reporter.Info() << std::endl;
}
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModuleNameOnly);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModulePath);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModulePathArgError);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModules);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModuleWithDetails);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationNotEnabledMessage);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationNoTestRun);
Expand Down
10 changes: 7 additions & 3 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ Please specify one of them using the --source option to proceed.</value>
<data name="ConfigurationSuccessfullyApplied" xml:space="preserve">
<value>Configuration successfully applied.</value>
</data>
<data name="ConfigurationUnitSuccessfullyApplied" xml:space="preserve">
<data name="ConfigurationUnitSuccessfullyApplied" xml:space="preserve">
<value>Unit successfully applied.</value>
</data>
<data name="ConfigurationWaitingOnAnother" xml:space="preserve">
Expand Down Expand Up @@ -3147,7 +3147,7 @@ Please specify one of them using the --source option to proceed.</value>
</data>
<data name="InstallerZeroByteFile" xml:space="preserve">
<value>Downloaded zero byte installer; ensure that your network connection is working properly.</value>
</data>
</data>
<data name="FontCommandShortDescription" xml:space="preserve">
<value>Manage fonts</value>
</data>
Expand Down Expand Up @@ -3183,4 +3183,8 @@ Please specify one of them using the --source option to proceed.</value>
<data name="FontVersion" xml:space="preserve">
<value>Version</value>
</data>
</root>
<data name="ConfigurationModules" xml:space="preserve">
<value>Configuration Modules</value>
<comment>PowerShell Modules that are used for the Configuration feature</comment>
</data>
</root>
2 changes: 2 additions & 0 deletions src/AppInstallerCommonCore/Public/AppInstallerRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ namespace AppInstaller::Runtime
SelfPackageRoot,
// The location where user downloads are stored.
UserProfileDownloads,
// The location where configuration modules are stored.
ConfigurationModules,
// The location where checkpoints are stored.
CheckpointsLocation,
// The location of the CLI executable file.
Expand Down
13 changes: 13 additions & 0 deletions src/AppInstallerCommonCore/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace AppInstaller::Runtime
constexpr std::string_view s_PortablePackagesDirectory = "Packages"sv;
constexpr std::string_view s_LinksDirectory = "Links"sv;
constexpr std::string_view s_FontsInstallDirectory = "Microsoft\\Windows\\Fonts"sv;
constexpr std::string_view s_ConfigurationModulesDirectory = "Configuration\\Modules"sv;
// Use production CLSIDs as a surrogate for repository location.
#if USE_PROD_CLSIDS
constexpr std::string_view s_ImageAssetsDirectoryRelative = "Assets\\WinGet"sv;
Expand Down Expand Up @@ -240,6 +241,16 @@ namespace AppInstaller::Runtime
case PathName::FontsMachineInstallLocation:
result.Path = GetKnownFolderPath(FOLDERID_Fonts);
break;
case PathName::ConfigurationModules:
result.Path = Settings::User().Get<Setting::ConfigureDefaultModuleRoot>();
if (result.Path.empty())
{
result.Path = GetKnownFolderPath(FOLDERID_LocalAppData);
result.Path /= s_SecureSettings_Base;
result.Path /= s_ConfigurationModulesDirectory;
}
mayBeInProfilePath = true;
break;
default:
THROW_HR(E_UNEXPECTED);
}
Expand Down Expand Up @@ -316,6 +327,7 @@ namespace AppInstaller::Runtime
case PathName::UserProfileDownloads:
case PathName::FontsUserInstallLocation:
case PathName::FontsMachineInstallLocation:
case PathName::ConfigurationModules:
result = GetPathDetailsCommon(path, forDisplay);
break;
case PathName::SelfPackageRoot:
Expand Down Expand Up @@ -422,6 +434,7 @@ namespace AppInstaller::Runtime
case PathName::UserProfileDownloads:
case PathName::FontsUserInstallLocation:
case PathName::FontsMachineInstallLocation:
case PathName::ConfigurationModules:
result = GetPathDetailsCommon(path, forDisplay);
break;
case PathName::SelfPackageRoot:
Expand Down

0 comments on commit df6a13a

Please sign in to comment.