@@ -139,12 +139,7 @@ public void addConfiguredClassPath(FileSet classPath) {
139139 String [] includedFiles = directoryScanner .getIncludedFiles ();
140140
141141 for (int i = 0 ; i < includedFiles .length ; i ++) {
142- File entry = new File (parent , includedFiles [i ]);
143- if (entry .isDirectory ()) {
144- throw new BuildException ("Class path entry cannot be a directory." );
145- }
146-
147- this .classPath .add (entry );
142+ this .classPath .add (new File (parent , includedFiles [i ]));
148143 }
149144 }
150145
@@ -264,12 +259,25 @@ public void execute() throws BuildException {
264259 File javaDirectory = new File (contentsDirectory , "Java" );
265260 javaDirectory .mkdir ();
266261
262+ File classesDirectory = new File (javaDirectory , "Classes" );
263+ classesDirectory .mkdir ();
264+
267265 File plugInsDirectory = new File (contentsDirectory , "PlugIns" );
268266 plugInsDirectory .mkdir ();
269267
270268 File resourcesDirectory = new File (contentsDirectory , "Resources" );
271269 resourcesDirectory .mkdir ();
272270
271+ // Generate Info.plist
272+ File infoPlistFile = new File (contentsDirectory , "Info.plist" );
273+ infoPlistFile .createNewFile ();
274+ writeInfoPlist (infoPlistFile );
275+
276+ // Generate PkgInfo
277+ File pkgInfoFile = new File (contentsDirectory , "PkgInfo" );
278+ pkgInfoFile .createNewFile ();
279+ writePkgInfo (pkgInfoFile );
280+
273281 // Copy executable to MacOS folder
274282 File executableFile = new File (macOSDirectory , EXECUTABLE_NAME );
275283 copy (getClass ().getResource (EXECUTABLE_NAME ), executableFile );
@@ -283,25 +291,20 @@ public void execute() throws BuildException {
283291
284292 // Copy class path entries to Java folder
285293 for (File entry : classPath ) {
286- // TODO Don't copy if in JRE
287- copy (entry , new File (javaDirectory , entry .getName ()));
294+ String name = entry .getName ();
295+
296+ if (entry .isDirectory () || name .endsWith (CLASS_EXTENSION )) {
297+ copy (entry , new File (classesDirectory , name ));
298+ } else {
299+ copy (entry , new File (javaDirectory , name ));
300+ }
288301 }
289302
290- // Copy native libraries to MacOS folder
303+ // Copy native libraries to Java folder
291304 for (File nativeLibrary : nativeLibraries ) {
292305 copy (nativeLibrary , new File (macOSDirectory , nativeLibrary .getName ()));
293306 }
294307
295- // Generate Info.plist
296- File infoPlistFile = new File (contentsDirectory , "Info.plist" );
297- infoPlistFile .createNewFile ();
298- writeInfoPlist (infoPlistFile );
299-
300- // Generate PkgInfo
301- File pkgInfoFile = new File (contentsDirectory , "PkgInfo" );
302- pkgInfoFile .createNewFile ();
303- writePkgInfo (pkgInfoFile );
304-
305308 // Copy icon to Resources folder
306309 if (icon == null ) {
307310 copy (getClass ().getResource (DEFAULT_ICON_NAME ), new File (resourcesDirectory ,
@@ -360,20 +363,6 @@ private void writeInfoPlist(File file) throws IOException {
360363 // Write main class name
361364 writeProperty (xout , "JVMMainClassName" , mainClassName );
362365
363- // Write class path
364- writeKey (xout , "JVMClassPath" );
365-
366- xout .writeStartElement (ARRAY_TAG );
367- xout .writeCharacters ("\n " );
368-
369- for (File entry : classPath ) {
370- // TODO Write appropriate path based on location
371- writeString (xout , "Contents/Java/" + entry .getName ());
372- }
373-
374- xout .writeEndElement ();
375- xout .writeCharacters ("\n " );
376-
377366 // Write options
378367 writeKey (xout , "JVMOptions" );
379368
0 commit comments