Changeset 35700
- Timestamp:
- 2021-10-25T00:39:08+13:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/search4j/libsearch4j.cpp
r35699 r35700 342 342 char* get_dirname (const char* full_file_path) 343 343 { 344 char* full_file_path_dup = strdup(full_file_path); 344 char* parent_dir = NULL; 345 346 if (full_file_path != NULL) { 347 348 char* full_file_path_dup = strdup(full_file_path); 345 349 #ifdef WINDOWS 346 char *p = strrchr(full_file_path_dup, '\\');350 char *p = strrchr(full_file_path_dup, '\\'); 347 351 #else 348 char *p = strrchr(full_file_path_dup, '/');352 char *p = strrchr(full_file_path_dup, '/'); 349 353 #endif 350 354 351 if (p != NULL) { 352 p[0] = 0; 355 if (p != NULL) { 356 // truncate the string at the point where the dir-separator was found 357 p[0] = 0; 358 parent_dir = full_file_path_dup; 359 } 360 else { 361 // no dir-separator found 362 free(full_file_path_dup); 363 full_file_path_dup = NULL; 364 } 353 365 } 354 355 return full_file_path_dup;366 367 return parent_dir; 356 368 } 357 369 … … 578 590 579 591 char* parent_dir = get_dirname(full_path_java); 580 char* parent_parent_dir = get_dirname(parent_dir); 592 char* parent_parent_dir = get_dirname(parent_dir); 581 593 582 594 javaHomeEnv = parent_parent_dir; 583 595 584 free(parent_dir); 596 if (parent_dir != NULL) { 597 free(parent_dir); 598 } 585 599 586 600 // Logic from here same as for other search4j java/javac testing 587 if ( verbose ) cout << "(" << javaHomeEnv << ") "; 588 jvm.setJavaHome( javaHomeEnv ); 589 if ( jvm.check() ) { 590 if ( use_minimum ) { 591 if ( jvm.compare( minimum ) >= 0 ) { 601 if (javaHomeEnv != NULL) { 602 if ( verbose ) cout << "(" << javaHomeEnv << ") "; 603 jvm.setJavaHome( javaHomeEnv ); 604 if ( jvm.check() ) { 605 if ( use_minimum ) { 606 if ( jvm.compare( minimum ) >= 0 ) { 607 jvmFound = true; 608 } 609 } else { 592 610 jvmFound = true; 593 611 } 594 } else {595 jvmFound = true;596 612 } 613 if ( (jreOnly && !jvm.getIsJre() ) || (jdkOnly && !jvm.getIsJdk()) ) { 614 jvmFound = false; 615 } 597 616 } 598 if ( (jreOnly && !jvm.getIsJre() ) || (jdkOnly && !jvm.getIsJdk()) ) {599 jvmFound = false;600 }601 602 617 } 603 618 if ( verbose ) { if( jvmFound ) cout << "yes" << endl; else cout << "no" << endl; }
Note:
See TracChangeset
for help on using the changeset viewer.