cannot do recursive libs on classpath after all

This commit is contained in:
Ben Fry
2021-06-22 07:35:54 -04:00
parent a4d13df9e6
commit 57fe977b3d

View File

@@ -421,16 +421,19 @@ int launch(char *commandName, int progargc, char *progargv[]) {
NSArray *cp = [infoDictionary objectForKey:@JVM_CLASSPATH_KEY];
if (cp == nil) {
// Implicit classpath, so use the contents of the "Java" folder to build an explicit classpath
[classPath appendFormat:@"%@/Classes", javaPath];
NSFileManager *defaultFileManager = [NSFileManager defaultManager];
// original, non-recursive version:
// https://developer.apple.com/documentation/foundation/nsfilemanager/1414584-contentsofdirectoryatpath
NSArray *javaDirectoryContents = [defaultFileManager contentsOfDirectoryAtPath:javaPath error:nil];
// changed to recursive version to walk the 'core' folder
// https://developer.apple.com/documentation/foundation/nsfilemanager/1417353-subpathsofdirectoryatpath
NSArray *javaDirectoryContents = [defaultFileManager subpathsOfDirectoryAtPath:javaPath error:nil];
// NSArray *javaDirectoryContents = [defaultFileManager subpathsOfDirectoryAtPath:javaPath error:nil];
// moving back away from this because we need the 'modules' directory off the classpath
if (javaDirectoryContents == nil) {
[[NSException exceptionWithName:@JAVA_LAUNCH_ERROR
reason:NSLocalizedString(@"JavaDirectoryNotFound", @UNSPECIFIED_ERROR)