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

Commit 9ca7ee7

Browse files
committed
add quotes for ${InfoPlistFile} to prevent breakdown if path contains spaces // fixes #2
1 parent 80dd00c commit 9ca7ee7

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/universalJavaApplicationStub

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ InfoPlistFile="${AppPackageFolder}"/Contents/Info.plist
101101

102102

103103
# read the program name from CFBundleName
104-
CFBundleName=`/usr/libexec/PlistBuddy -c "print :CFBundleName" ${InfoPlistFile}`
104+
CFBundleName=`/usr/libexec/PlistBuddy -c "print :CFBundleName" "${InfoPlistFile}"`
105105

106106
# read the icon file name
107-
CFBundleIconFile=`/usr/libexec/PlistBuddy -c "print :CFBundleIconFile" ${InfoPlistFile}`
107+
CFBundleIconFile=`/usr/libexec/PlistBuddy -c "print :CFBundleIconFile" "${InfoPlistFile}"`
108108

109109

110110
# read Info.plist in Apple style
111111
if [ -d "${AppleJavaFolder}" ]; then
112112

113113
# read the Java WorkingDirectory
114-
JVMWorkDir=`/usr/libexec/PlistBuddy -c "print :Java:WorkingDirectory" ${InfoPlistFile} 2> /dev/null | xargs`
114+
JVMWorkDir=`/usr/libexec/PlistBuddy -c "print :Java:WorkingDirectory" "${InfoPlistFile}" 2> /dev/null | xargs`
115115

116116
# set Working Directory based upon Plist info
117117
if [ "${JVMWorkDir}" == "\$JAVAROOT" ]; then
@@ -133,16 +133,16 @@ if [ -d "${AppleJavaFolder}" ]; then
133133
ResourcesFolder="${AppleResourcesFolder}"
134134

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

138138
# read the JVM Options
139-
JVMOptions=`/usr/libexec/PlistBuddy -c "print :Java:Properties" ${InfoPlistFile} 2> /dev/null | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
139+
JVMOptions=`/usr/libexec/PlistBuddy -c "print :Java:Properties" "${InfoPlistFile}" 2> /dev/null | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
140140

141141
# read the JVM Default Options
142-
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :Java:VMOptions" ${InfoPlistFile} 2> /dev/null | xargs`
142+
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :Java:VMOptions" "${InfoPlistFile}" 2> /dev/null | xargs`
143143

144144
# read the JVM Arguments
145-
JVMArguments=`/usr/libexec/PlistBuddy -c "print :Java:Arguments" ${InfoPlistFile} 2> /dev/null | xargs`
145+
JVMArguments=`/usr/libexec/PlistBuddy -c "print :Java:Arguments" "${InfoPlistFile}" 2> /dev/null | xargs`
146146

147147

148148
# read Info.plist in Oracle style
@@ -154,16 +154,16 @@ elif [ -d "${OracleJavaFolder}" ]; then
154154
WorkingDirectory="${OracleJavaFolder}"
155155

156156
# read the MainClass name
157-
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :JVMMainClassName" ${InfoPlistFile} 2> /dev/null`
157+
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :JVMMainClassName" "${InfoPlistFile}" 2> /dev/null`
158158

159159
# read the JVM Options
160-
JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" ${InfoPlistFile} 2> /dev/null | grep " -" | tr '\n' ' ' | sed 's/ */ /g' | xargs`
160+
JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" "${InfoPlistFile}" 2> /dev/null | grep " -" | tr '\n' ' ' | sed 's/ */ /g' | xargs`
161161

162162
# read the JVM Default Options
163-
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" ${InfoPlistFile} 2> /dev/null | grep -o "\-.*" | tr '\n' ' ' | xargs`
163+
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" "${InfoPlistFile}" 2> /dev/null | grep -o "\-.*" | tr '\n' ' ' | xargs`
164164

165165
# read the JVM Arguments
166-
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" ${InfoPlistFile} 2> /dev/null | tr '\n' ' ' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
166+
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" "${InfoPlistFile}" 2> /dev/null | tr '\n' ' ' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
167167

168168
fi
169169

0 commit comments

Comments
 (0)