Skip to content

Commit

Permalink
Use FolderId_ProgramFiles for non x86 default machine portable folder (
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed Apr 10, 2023
1 parent 850a599 commit 719e475
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/AppInstallerCLICore/Commands/RootCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/PortableInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace AppInstaller::CLI::Portable
}
else
{
return Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRootX64);
return Runtime::GetPathTo(Runtime::PathName::PortablePackageMachineRoot);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/AppInstallerCommonCore/Public/AppInstallerRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 12 additions & 6 deletions src/AppInstallerCommonCore/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 719e475

Please sign in to comment.