Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume neutral architecture when none is specified #90

Merged
merged 1 commit into from
Jan 16, 2018

Conversation

HowardWolosky
Copy link
Member

Per the MSDN documentation,
neutral is the default value for ProcessorArchitecture.

Updating our Appx metadata reading logic to assume neutral when none is specified.

This will avoid a later exception in Get-FormattedFilename that does Metadata table validation.

Resolves Issue #89

@@ -1962,7 +1967,7 @@ function Get-FormattedFilename
return $formattedBundleTags -join '_'
}

function Read-ApplicationMetadata
function Read-OOoOOApplicationMetadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. Fixed, thanks.

@@ -1608,6 +1608,11 @@ function Read-AppxMetadata

$metadata.version = $manifest.Package.Identity.Version
$metadata.architecture = $manifest.Package.Identity.ProcessorArchitecture
if ([String]::IsNullOrWhiteSpace($metadata.architecture))
{
$metadata.architecture = "neutral"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be single-assignment:

$metadata.architecture = if (...) { … } else { … }

Alternatively, I've been wanting a custom helper function like:

$metadata.architecture = If-NotNull -Then $manifest.Package.Identity.ProcessorArchitecture -Else "neutral"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're describing creating a null-coalescing operator (?? in C#). but for PowerShell.

Given that this is the type of base functionality that a language should support, and given the fact that it's being considered for 6.1, I'd rather not try to roll our own at this time.

I'd prefer to leave as-is.

Per the [MSDN documentation](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-identity),
`neutral` is the default value for `ProcessorArchitecture`.

Updating our Appx metadata reading logic to assume `neutral` when none is specified.

This will avoid a later exception in `Get-FormattedFilename` that does Metadata table validation.

Resolves Issue 89
@HowardWolosky HowardWolosky merged commit 4405654 into microsoft:master Jan 16, 2018
@HowardWolosky HowardWolosky deleted the neutral branch January 16, 2018 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants