diff options
author | David Herman <davidherman@google.com> | 2014-10-10 12:12:00 -0700 |
---|---|---|
committer | David Herman <davidherman@google.com> | 2014-10-10 14:53:58 -0700 |
commit | 81f21b205762b11189ba53267bac4c9c1e83181a (patch) | |
tree | 9733d4294be777c245497fdd7edb6c36183e485c /find_java/src/source | |
parent | 4a7b893a4da91b4d83095c32e88bcaf939010e4c (diff) | |
download | sdk-81f21b205762b11189ba53267bac4c9c1e83181a.zip sdk-81f21b205762b11189ba53267bac4c9c1e83181a.tar.gz sdk-81f21b205762b11189ba53267bac4c9c1e83181a.tar.bz2 |
find_java: new method to search in a custom path
Change-Id: I081871bbff9c6e714eda3e47ee16e8b486e2355b
Diffstat (limited to 'find_java/src/source')
-rwxr-xr-x | find_java/src/source/find_java.h | 2 | ||||
-rwxr-xr-x | find_java/src/source/find_java_lib.cpp | 16 |
2 files changed, 17 insertions, 1 deletions
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);
|