mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[r: andrey.zaytzev] IDEA-105363
This commit is contained in:
@@ -64,18 +64,22 @@ typedef jint (JNICALL *fun_ptr_t_CreateJavaVM)(JavaVM **pvm, void **env, void *a
|
||||
}
|
||||
|
||||
|
||||
void appendBundle(NSString *path, NSMutableArray *sink) {
|
||||
if ([path hasSuffix:@".jdk"] || [path hasSuffix:@".jre"]) {
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:path];
|
||||
if (bundle != nil) {
|
||||
[sink addObject:bundle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void appendJvmBundlesAt(NSString *path, NSMutableArray *sink) {
|
||||
NSError *error = nil;
|
||||
NSArray *names = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:&error];
|
||||
|
||||
if (names != nil) {
|
||||
for (NSString *name in names) {
|
||||
if ([name hasSuffix:@".jdk"] || [name hasSuffix:@".jre"]) {
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:[path stringByAppendingPathComponent:name]];
|
||||
if (bundle != nil) {
|
||||
[sink addObject:bundle];
|
||||
}
|
||||
}
|
||||
appendBundle([path stringByAppendingPathComponent:name], sink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +90,7 @@ NSArray *allVms() {
|
||||
NSString *explicit = [[[NSProcessInfo processInfo] environment] objectForKey:@"IDEA_JDK"];
|
||||
|
||||
if (explicit != nil) {
|
||||
appendJvmBundlesAt(explicit, jvmBundlePaths);
|
||||
appendBundle(explicit, jvmBundlePaths);
|
||||
}
|
||||
else {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
|
||||
Reference in New Issue
Block a user