commit 719e475a7638b5ceec7a5bf3e8c811bdbfb0d785
parent 850a59967394adbfb9d0d8819fa54c7852ea232a
Author: yao-msft <50888816+yao-msft@users.noreply.github.com>
Date: Mon, 10 Apr 2023 13:00:16 -0700
Use FolderId_ProgramFiles for non x86 default machine portable folder (#3137)
Diffstat:
6 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp
@@ -135,11 +135,8 @@ namespace AppInstaller::CLI
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableLinksUser }, Runtime::GetPathTo(Runtime::PathName::PortableLinksUserLocation, true).u8string() });
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableLinksMachine }, Runtime::GetPathTo(Runtime::PathName::PortableLinksMachineLocation, true).u8string() });
keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableRootUser }, Runtime::GetPathTo(Runtime::PathName::PortablePackageUserRoot, true).u8string() });
+ 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() });
- if (Utility::GetSystemArchitecture() == Utility::Architecture::X64 || Utility::GetSystemArchitecture() == Utility::Architecture::Arm64)
- {
- keyDirectories.OutputLine({ Resource::LocString{ Resource::String::PortableRoot64 }, Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRootX64, true).u8string() });
- }
keyDirectories.Complete();
context.Reporter.Info() << std::endl;
}
diff --git a/src/AppInstallerCLICore/PortableInstaller.cpp b/src/AppInstallerCLICore/PortableInstaller.cpp
@@ -44,7 +44,7 @@ namespace AppInstaller::CLI::Portable
}
else
{
- return Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRootX64);
+ return Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRoot);
}
}
else
diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h
@@ -317,7 +317,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(PortableLinksUser);
WINGET_DEFINE_RESOURCE_STRINGID(PortablePackageAlreadyExists);
WINGET_DEFINE_RESOURCE_STRINGID(PortableRegistryCollisionOverridden);
- WINGET_DEFINE_RESOURCE_STRINGID(PortableRoot64);
+ WINGET_DEFINE_RESOURCE_STRINGID(PortableRoot);
WINGET_DEFINE_RESOURCE_STRINGID(PortableRoot86);
WINGET_DEFINE_RESOURCE_STRINGID(PortableRootUser);
WINGET_DEFINE_RESOURCE_STRINGID(PositionArgumentDescription);
diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
@@ -1415,11 +1415,11 @@ Please specify one of them using the --source option to proceed.</value>
<data name="PortableRootUser" xml:space="preserve">
<value>Portable Package Root (User)</value>
</data>
- <data name="PortableRoot64" xml:space="preserve">
- <value>Portable Package Root (x86)</value>
+ <data name="PortableRoot" xml:space="preserve">
+ <value>Portable Package Root</value>
</data>
<data name="PortableRoot86" xml:space="preserve">
- <value>Portable Package Root (x64)</value>
+ <value>Portable Package Root (x86)</value>
</data>
<data name="PortableInstallFailed" xml:space="preserve">
<value>Portable install failed; Cleaning up...</value>
diff --git a/src/AppInstallerCommonCore/Public/AppInstallerRuntime.h b/src/AppInstallerCommonCore/Public/AppInstallerRuntime.h
@@ -52,8 +52,8 @@ namespace AppInstaller::Runtime
UserProfile,
// The location where portable packages are installed to with user scope.
PortablePackageUserRoot,
- // The location where portable packages are installed to with machine scope (x64).
- PortablePackageMachineRootX64,
+ // The location where portable packages are installed to with machine scope.
+ PortablePackageMachineRoot,
// The location where portable packages are installed to with machine scope (x86).
PortablePackageMachineRootX86,
// The location where symlinks to portable packages are stored under user scope.
diff --git a/src/AppInstallerCommonCore/Runtime.cpp b/src/AppInstallerCommonCore/Runtime.cpp
@@ -448,11 +448,11 @@ namespace AppInstaller::Runtime
result.Path /= s_PortablePackagesDirectory;
}
break;
- case PathName::PortablePackageMachineRootX64:
+ case PathName::PortablePackageMachineRoot:
result.Path = Settings::User().Get<Setting::PortablePackageMachineRoot>();
if (result.Path.empty())
{
- result.Path = GetKnownFolderPath(FOLDERID_ProgramFilesX64);
+ result.Path = GetKnownFolderPath(FOLDERID_ProgramFiles);
result.Path /= s_PortablePackageRoot;
result.Path /= s_PortablePackagesDirectory;
}
@@ -534,7 +534,7 @@ namespace AppInstaller::Runtime
}
break;
case PathName::UserProfile:
- case PathName::PortablePackageMachineRootX64:
+ case PathName::PortablePackageMachineRoot:
case PathName::PortablePackageMachineRootX86:
case PathName::PortableLinksMachineLocation:
result = GetPathDetailsCommon(path);
@@ -618,13 +618,19 @@ namespace AppInstaller::Runtime
}
break;
case PathName::UserProfile:
- case PathName::PortablePackageUserRoot:
- case PathName::PortablePackageMachineRootX64:
+ case PathName::PortablePackageMachineRoot:
case PathName::PortablePackageMachineRootX86:
- case PathName::PortableLinksUserLocation:
case PathName::PortableLinksMachineLocation:
result = GetPathDetailsCommon(path);
break;
+ case PathName::PortableLinksUserLocation:
+ case PathName::PortablePackageUserRoot:
+ result = GetPathDetailsCommon(path);
+ if (forDisplay)
+ {
+ ReplaceCommonPathPrefix(result.Path, GetKnownFolderPath(FOLDERID_LocalAppData), "%LOCALAPPDATA%");
+ }
+ break;
case PathName::SelfPackageRoot:
result.Path = GetBinaryDirectoryPath();
result.Create = false;