-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Yamlcreate.ps1 throws exception: "Join-Path : A positional parameter cannot be found that accepts argument" #3061
Comments
I have tried to reproduce the issue but I am unable to get the same error. I did however use PowerShell Core 7. I did use x86 as the arch but that should not matter? I added Jadx 1.1.0 in a new pull request here #3066 EDIT: I did some more testing on what and how Jadx's behavior is and found out that it does not have an installer. It is a portable application that does not require installation so it is not very manageable with winget. Possible issue to support this microsoft/winget-cli#182 |
@philnach are you able to reproduce the issue? |
@denelon, I'll attach the PowerShell execution transcript for you later today. |
@denelon , I tried with x86 as well, still the same failure. Attached is the PowerShell transcript |
@denelon, I think I figured it out. I'm on PowerShell 5.1 and in PowerShell 6.0 "-AdditionalChildPath" was added which let's you append multiple paths together StackOverflow suggestion. We could fix the line by doing the following: $FileLocation = Join-Path "" -ChildPath "manifests" | Join-Path -ChildPath $id.Split('.')[0] | Join-Path -ChildPath $id.Split('.')[1] I'm more than happy to create a PR, unless you think we should require a minimum of PowerShell 6 for running the script? |
@philnach as long as this isn't going to be a breaking change for other versions of PowerShell, I'm fine with supporting multiple earlier versions. |
@denelon, perfect, I'll get the change coded up and verify PowerShell 5.1, 6.0 and 7. Probably send out a PR tomorrow (8/21). |
@philnach If you're going to submit a PR please don't submit a fix that looks like this
That code that is hard to maintain and does not follow PowerShell best practices. It probably makes sense to add a minimum version requirement to the script. This can be done by beginning the #Requires -Version 5.1 You can then use PSScriptAnalyzer to tell you about incompatible version specific features. Edit: |
@megamorf, thanks for the feedback, I'm not an expert when it comes to PowerShell, it would be awesome if you could fix the script to work with PowerShell 5.1? I had something slightly different, but it's good you brought up that it doesn't follow best practice. |
* this commit removes PowerShell Core only features that were introduced with microsoft#2378 to ensure compatibility with PSv5 * adds comment based help * use consistently cased Cmdlet and variable names * improves input data related error handling * adds PS code regions for automatic code folding * automates the creation of the manifest file at the correct destination path * corrects the use of Write-Host and Write-Output Fixes microsoft#3061
* Make script PSv5 compatible again, apply some PS best practices * this commit removes PowerShell Core only features that were introduced with #2378 to ensure compatibility with PSv5 * adds comment based help * use consistently cased Cmdlet and variable names * improves input data related error handling * adds PS code regions for automatic code folding * automates the creation of the manifest file at the correct destination path * corrects the use of Write-Host and Write-Output Fixes #3061 * Adhere to YAML formatting conventions * Use cross-platform new line handling Co-authored-by: Sebastian Neumann <sebastian.neumann@experienceone.com>
Brief description of your issue
Ran the YamlCreate.ps1 script from directly from the tools directory results in invalid argument exception when the tool goes to build manifest due to a package id folder not existing
Steps to reproduce
Run YamlCreate.ps1 directly from the tools directory. Below are the specified values I entered:
Id: skylot.jadx
Version: 1.1.0
Name: jadx
Publisher: skylot
License: Apache License 2.0
LicenseUrl: https://github.com/skylot/jadx/blob/master/LICENSE
AppMoniker: jadx
Tags: Java, Dex, android, APK
Description: Command line and GUI tools to produce Java source code from Android Dex and APK files
Homepage: https://github.com/skylot/jadx
Arch: Neutral
Url: https://github.com/skylot/jadx/releases/download/v1.1.0/jadx-gui-1.1.0-no-jre.exe
Sha256: D2D8FBB71BAEC7FFE99633231397DFF419AB12D09C18171E75DAE6D994C79984
InstallerType: exe
Expected behavior
YamlCreate.ps1 doesn't throw an exception and creates manifest in a package id folder
Actual behavior
Exception is thrown during script execution:
Environment
Windows 10 2004 OS Build 19041.450
The text was updated successfully, but these errors were encountered: