]> Dogcows Code - chaz/vimcoder/blobdiff - src/com/dogcows/Editor.java
do not overwrite makefiles while opening a problem
[chaz/vimcoder] / src / com / dogcows / Editor.java
index 2f2896248113e30da45d75d3d68995bc04141389..eca84208ad675a66706995396744d2d821845537 100644 (file)
@@ -1,12 +1,9 @@
 
 package com.dogcows;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.*;
 
 import com.topcoder.client.contestant.ProblemComponentModel;
@@ -92,7 +89,7 @@ public class Editor
 
                // Set up the terms used for the template expansion.
                HashMap<String,String> terms = new HashMap<String,String>();
-               terms.put("RETURNTYPE",   component.getReturnType().getDescriptor(language).replaceAll("\\s+", ""));
+               terms.put("RETURNTYPE",   component.getReturnType().getDescriptor(language));
                terms.put("CLASSNAME",    name);
                terms.put("METHODNAME",   component.getMethodName());
                terms.put("METHODPARAMS", getMethodParams(component.getParamTypes(),
@@ -100,7 +97,7 @@ public class Editor
                                                                                                  language));
                terms.put("METHODPARAMNAMES",     Util.join(component.getParamNames(), ", "));
                terms.put("METHODPARAMSTREAMIN",  Util.join(component.getParamNames(), " >> "));
-               terms.put("METHODPARAMSTREAMOUT", Util.join(component.getParamNames(), " << "));
+               terms.put("METHODPARAMSTREAMOUT", Util.join(component.getParamNames(), " << \", \" << "));
                terms.put("METHODPARAMDECLARES",  getMethodParamDeclarations(component.getParamTypes(),
                                                                                                                                         component.getParamNames(),
                                                                                                                                         language));
@@ -167,6 +164,7 @@ public class Editor
 
                // Finally, expand the Makefile template and write it.
                File makeFile = new File(directory, "Makefile");
+               if (!makeFile.canRead())
                {
                        String text = Util.expandTemplate(readTemplate(lang + "Makefile"),
                                                                                          terms);
@@ -246,7 +244,7 @@ public class Editor
                 * before the timeout, we will assume it is not backgrounding and
                 * that everything worked.  This works as long as the Vim server is
                 * able to start within the stall period. */
-               long expire = System.currentTimeMillis() + 250;
+               long expire = System.currentTimeMillis() + 1000;
                while (System.currentTimeMillis() < expire)
                {
                        Thread.yield();
@@ -298,7 +296,7 @@ public class Editor
                String[] strings = new String[types.length];
                for (int i = 0; i < types.length; ++i)
                {
-                       strings[i] = types[i].getDescriptor(language).replaceAll("\\s+", "");
+                       strings[i] = types[i].getDescriptor(language);
                }
                return strings;
        }
This page took 0.021648 seconds and 4 git commands to generate.