Commit a47babba authored by Katie Laverty's avatar Katie Laverty

Merge branch 'master' of github.com:mit-cml/app-inventor-private into version-number

parents a0185198 f6ae5106
......@@ -422,6 +422,9 @@ public class YABlockCompiler {
*/
public static String packageNameFromPath(String path) {
path = path.replaceFirst(".*?/?src/", "");
if (System.getProperty("os.name").startsWith("Windows")){
path = path.replace("/","\\").replaceFirst(".*?/?src/", "");
}
int extensionIndex = path.lastIndexOf(".");
if (extensionIndex != -1) {
return path.substring(0, extensionIndex).replaceAll("/", ".");
......
......@@ -75,6 +75,8 @@ public final class Compiler {
RUNTIME_FILES_DIR + "android.jar";
private static final String MAC_AAPT_TOOL =
"/tools/mac/aapt";
private static final String WINDOWS_AAPT_TOOL =
"/tools/windows/aapt";
private static final String LINUX_AAPT_TOOL =
"/tools/linux/aapt";
private static final String KAWA_RUNTIME =
......@@ -422,6 +424,10 @@ public final class Compiler {
String sourceFileRelativePath = sourceFileName.substring(srcIndex + 8);
String classFileName = (classesDir.getAbsolutePath() + "/" + sourceFileRelativePath)
.replace(YoungAndroidConstants.YAIL_EXTENSION, ".class");
if (System.getProperty("os.name").startsWith("Windows")){
classFileName = classesDir.getAbsolutePath()
.replace(YoungAndroidConstants.YAIL_EXTENSION, ".class");
}
// Check whether user code exists by seeing if a left parenthesis exists at the beginning of
// a line in the file
......@@ -523,6 +529,10 @@ public final class Compiler {
// This works when a JDK is installed with the JRE.
jarsignerFile = new File(javaHome + File.separator + ".." + File.separator + "bin" +
File.separator + "jarsigner");
if (System.getProperty("os.name").startsWith("Windows")){
jarsignerFile = new File(javaHome + File.separator + ".." + File.separator + "bin" +
File.separator + "jarsigner.exe");
}
if (!jarsignerFile.exists()) {
LOG.warning("YAIL compiler - could not find jarsigner.");
err.println("YAIL compiler - could not find jarsigner.");
......@@ -629,7 +639,9 @@ public final class Compiler {
aaptTool = MAC_AAPT_TOOL;
} else if (osName.equals("Linux")) {
aaptTool = LINUX_AAPT_TOOL;
} else {
} else if (osName.startsWith("Windows")) {
aaptTool = WINDOWS_AAPT_TOOL;
} else {
LOG.warning("YAIL compiler - cannot run AAPT on OS " + osName);
err.println("YAIL compiler - cannot run AAPT on OS " + osName);
userErrors.print(String.format(ERROR_IN_STAGE, "AAPT"));
......
......@@ -98,7 +98,11 @@ public final class Execution {
public static boolean execute(File workingDir, String[] command, PrintStream out,
PrintStream err) {
LOG.log(Level.INFO, "____Executing " + joiner.join(command));
if (System.getProperty("os.name").startsWith("Windows")){
for(int i =0; i < command.length; i++){
command[i] = command[i].replace("\"", "\\\"");
}
}
try {
Process process = Runtime.getRuntime().exec(command, null, workingDir);
new RedirectStreamHandler(new PrintWriter(out, true), process.getInputStream());
......
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