Commit 5ff60ab0 authored by Weihua Li's avatar Weihua Li

Internal issue:207, set up software problem in Wins 64 bit machine/limited account

Change-Id: I11147091a0a58cc95bcbb187a1f67116f7d5ed53
parent 3d3f8727
......@@ -361,10 +361,31 @@ public final class AIDirectory {
// to access the envars in Java.
// See http://en.wikipedia.org/wiki/Environment_variable#System_path_variables
private final String findWindowsCandidate() throws NoAIDirectoryException {
String candidate;
String candidate = null;
// "Appinventor Setup" is specified in the installed build file
final String registryQuery =
"reg.exe QUERY \"HKCU\\Software\\Appinventor Setup\" /v PATH";
// Need to look for all the 4 places since the differences in 32/64 bits
final String[] registryQuerys = new String[]{
"reg.exe QUERY \"HKLM\\Software\\Appinventor Setup\" /v PATH",
"reg.exe QUERY \"HKCU\\Software\\Appinventor Setup\" /v PATH",
"reg.exe QUERY \"HKLM\\Software\\Wow6432Node\\Appinventor Setup\" /v PATH",
"reg.exe QUERY \"HKCU\\Software\\Wow6432Node\\Appinventor Setup\" /v PATH",
};
for(int i =0; i<registryQuerys.length; i++){
candidate = lookForWindowsCandiate(registryQuerys[i]);
// At this point, candidate is the result of reading the registry. Now we need to test it.
// Just because we found the directory in the registry, it doesn't mean
// that the directory was there.
if (candidate != null && testCandidate(candidate)) {
return candidate;
}
}
// getCandidateFromUser will throw a NoAIDirectoryException if it loses
return getCandidateFromUser(candidate);
}
private final String lookForWindowsCandiate(String registryQuery) throws NoAIDirectoryException{
String candidate;
try {
// The HKCU key might not exist and reg.exe will produce
// an error. Possible reasons are that the Appinventor Setup software
......@@ -391,15 +412,7 @@ public final class AIDirectory {
System.out.println("Got error trying to read registry: " + e.getMessage());
candidate = null;
}
// At this point, candidate is the result of reading the registry. Now we need to test it.
// Just because we found the directory in the registry, it doesn't mean
// that the directory was there.
if (candidate != null && testCandidate(candidate)) {
return candidate;
} else {
// getCandidateFromUser will throw a NoAIDirectoryException if it loses
return getCandidateFromUser(candidate);
}
}
// Prints a message and requests the user to enter a location. The input
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment