Changeset 35699 for main/trunk
- Timestamp:
- 2021-10-25T00:14:15+13:00 (3 years ago)
- Location:
- main/trunk/search4j
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/search4j/libsearch4j.cpp
r35698 r35699 339 339 #endif 340 340 341 342 char* get_dirname (const char* full_file_path) 343 { 344 char* full_file_path_dup = strdup(full_file_path); 345 #ifdef WINDOWS 346 char *p = strrchr(full_file_path_dup, '\\'); 347 #else 348 char *p = strrchr(full_file_path_dup, '/'); 349 #endif 350 351 if (p != NULL) { 352 p[0] = 0; 353 } 354 355 return full_file_path_dup; 356 } 357 341 358 /* 342 359 * function to find java … … 348 365 if ( verbose ) cout << "Searching for a JVM" << endl; 349 366 350 char *javaHomeEnv = NULL; 367 char *javaHomeEnv = NULL; // use below would benefit from more careful application of strdup()/free() 351 368 bool jvmFound = false; 352 369 … … 559 576 if ( strcmp(full_path_java,"") != 0) { 560 577 // go two directories up from where 'java' was found 561 javaHomeEnv = dirname(dirname(full_path_java)); 562 578 579 char* parent_dir = get_dirname(full_path_java); 580 char* parent_parent_dir = get_dirname(parent_dir); 581 582 javaHomeEnv = parent_parent_dir; 583 584 free(parent_dir); 585 563 586 // Logic from here same as for other search4j java/javac testing 564 587 if ( verbose ) cout << "(" << javaHomeEnv << ") "; -
main/trunk/search4j/libsearch4j.h
r35698 r35699 6 6 #include <sstream> 7 7 #include <sys/stat.h> 8 9 #include <libgen.h>10 8 11 9 using namespace std;
Note:
See TracChangeset
for help on using the changeset viewer.