@@ -76,25 +76,22 @@ jobs:
7676 - name : Build installers and portable app image (Windows)
7777 if : matrix.os == 'windows-latest'
7878 run : |
79- # Junction for short JAVA_HOME (used only when calling jpackage to avoid CreateProcess path limit )
79+ # Short JAVA_HOME/PATH for jpackage only (avoids "filename or extension is too long" )
8080 if (Test-Path C:\j) { cmd /c rmdir C:\j }
8181 cmd /c mklink /J C:\j $env:JAVA_HOME
82+ $env:JAVA_HOME = "C:\j"
83+ $env:PATH = "C:\j\bin;C:\Windows\System32;C:\Windows"
8284 subst X: $env:GITHUB_WORKSPACE
8385 New-Item -ItemType Directory -Force -Path "C:\t" | Out-Null
8486 cd X:\desktop-client
85- $MAVEN_VERSION = mvn help:evaluate -Dexpression=project.version -q -DforceStdout
86- $APP_VERSION = $MAVEN_VERSION -replace "-SNAPSHOT", "" -replace "-.*", ""
87- if ($APP_VERSION -notmatch "\.") {
88- $APP_VERSION = "$APP_VERSION.0"
89- }
90- $JAR_NAME = (Get-ChildItem target\desktop-client-*.jar | Select-Object -First 1).Name
87+ $jarFile = Get-ChildItem target\desktop-client-*.jar | Select-Object -First 1
88+ $JAR_NAME = $jarFile.Name
89+ $APP_VERSION = ($jarFile.BaseName -replace 'desktop-client-', '') -replace '-SNAPSHOT', '' -replace '-.*', ''
90+ if ($APP_VERSION -notmatch "\.") { $APP_VERSION = "$APP_VERSION.0" }
9191 $ICON_ARG = ""
9292 if (Test-Path "src\main\resources\icons\app-icon.ico") {
9393 $ICON_ARG = "--icon src\main\resources\icons\app-icon.ico"
9494 }
95- # Short PATH only for jpackage to avoid "filename or extension is too long"
96- $env:JAVA_HOME = "C:\j"
97- $env:PATH = "C:\j\bin;C:\Windows\System32;C:\Windows"
9895 jpackage --input target `
9996 --name "JSTutor" `
10097 --main-jar $JAR_NAME `
0 commit comments