From 81f21b205762b11189ba53267bac4c9c1e83181a Mon Sep 17 00:00:00 2001 From: David Herman Date: Fri, 10 Oct 2014 12:12:00 -0700 Subject: find_java: new method to search in a custom path Change-Id: I081871bbff9c6e714eda3e47ee16e8b486e2355b --- find_java/src/source/find_java.h | 2 +- find_java/src/source/find_java_lib.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'find_java') diff --git a/find_java/src/source/find_java.h b/find_java/src/source/find_java.h index 1181aa1..3b60111 100755 --- a/find_java/src/source/find_java.h +++ b/find_java/src/source/find_java.h @@ -26,7 +26,7 @@ #define MIN_JAVA_VERSION_MINOR 6 #define MIN_JAVA_VERSION (MIN_JAVA_VERSION_MAJOR * 1000 + MIN_JAVA_VERSION_MINOR) - +int checkJavaInPath(const CPath &path); int findJavaInEnvPath(CPath *outJavaPath); int findJavaInRegistry(CPath *outJavaPath); int findJavaInProgramFiles(CPath *outJavaPath); diff --git a/find_java/src/source/find_java_lib.cpp b/find_java/src/source/find_java_lib.cpp index 4c04e7f..f292171 100755 --- a/find_java/src/source/find_java_lib.cpp +++ b/find_java/src/source/find_java_lib.cpp @@ -99,6 +99,22 @@ static int checkBinPath(CPath *inOutPath) { return checkPath(inOutPath); } +// Test for the existence of java.exe in a custom path +int checkJavaInPath(const CPath &path) { + SetLastError(0); + + int currVersion = 0; + CPath temp(path); + currVersion = checkBinPath(&temp); + if (currVersion > 0) { + if (gIsDebug) { + fprintf(stderr, "Java %d found in path: %s\n", currVersion, temp.cstr()); + } + } + + return currVersion; +} + // Search java.exe in the environment int findJavaInEnvPath(CPath *outJavaPath) { SetLastError(0); -- cgit v1.1