Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit cabe320

Browse files
committed
WorkingDirectory: improved substitution of variables // fixes #12
$JAVAROOT, $APP_PACKAGE, $USER_HOME
1 parent 51e0889 commit cabe320

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

src/universalJavaApplicationStub

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,29 @@ exitcode=$?
118118
# read Info.plist in Apple style if exit code returns 0 (true, :Java key is present)
119119
if [ $exitcode -eq 0 ]; then
120120

121+
# set Java and Resources folder
122+
JavaFolder="${AppleJavaFolder}"
123+
ResourcesFolder="${AppleResourcesFolder}"
124+
125+
APP_PACKAGE="${AppPackageFolder}"
126+
JAVAROOT="${AppleJavaFolder}"
127+
USER_HOME="$HOME"
128+
129+
121130
# read the Java WorkingDirectory
122131
JVMWorkDir=`/usr/libexec/PlistBuddy -c "print :Java:WorkingDirectory" "${InfoPlistFile}" 2> /dev/null | xargs`
123132

124133
# set Working Directory based upon Plist info
125-
if [ "${JVMWorkDir}" == "\$JAVAROOT" ]; then
126-
WorkingDirectory="${AppleJavaFolder}"
127-
128-
elif [ "${JVMWorkDir}" == "\$APP_PACKAGE" ]; then
129-
WorkingDirectory="${AppPackageFolder}"
130-
131-
elif [ "${JVMWorkDir}" == "\$USER_HOME" ]; then
132-
WorkingDirectory="$HOME"
133-
134-
elif [[ ! -z ${JVMWorkDir} ]]; then
134+
if [[ ! -z ${JVMWorkDir} ]]; then
135135
WorkingDirectory="${JVMWorkDir}"
136-
137136
else
138137
# AppPackageRoot is the standard WorkingDirectory when the script is started
139138
WorkingDirectory="${AppPackageRoot}"
140139
fi
141-
142-
# set Java and Resources folder
143-
JavaFolder="${AppleJavaFolder}"
144-
ResourcesFolder="${AppleResourcesFolder}"
145140

146-
APP_PACKAGE="${AppPackageFolder}"
147-
JAVAROOT="${AppleJavaFolder}"
148-
USER_HOME="$HOME"
141+
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
142+
WorkingDirectory=`eval "echo ${WorkingDirectory}"`
143+
149144

150145
# read the MainClass name
151146
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :Java:MainClass" "${InfoPlistFile}" 2> /dev/null`

0 commit comments

Comments
 (0)