Print

Print


Commit in lcsim/src/org/lcsim/job on MAIN
JobControlManager.java+16-41.46 -> 1.47
support the ~ character in file and classpath strings

lcsim/src/org/lcsim/job
JobControlManager.java 1.46 -> 1.47
diff -u -r1.46 -r1.47
--- JobControlManager.java	10 Jun 2010 18:34:58 -0000	1.46
+++ JobControlManager.java	28 Jul 2010 21:40:28 -0000	1.47
@@ -46,7 +46,7 @@
  * The command line syntax is <code>java -jar ./lib/lcsim.jar steeringFile.xml</code>.
  * 
  * @author jeremym
- * @version $Id: JobControlManager.java,v 1.46 2010/06/10 18:34:58 jeremy Exp $
+ * @version $Id: JobControlManager.java,v 1.47 2010/07/28 21:40:28 jeremy Exp $
  */
 public class JobControlManager
 {
@@ -366,7 +366,7 @@
 	
 	private File processFileElement(Element fileElement, List<File> fileList)
 	{
-	    String fileLoc = fileElement.getText().trim();
+	    String fileLoc = processPath(fileElement.getText().trim());
         File file = null;
         
         // Try to process the file text as a URL.
@@ -690,7 +690,7 @@
 				Element jarElement = (Element) jarObject;
 				try
 				{
-					urlList.add((new File(jarElement.getText()).toURL()));
+					urlList.add((new File(processPath(jarElement.getText())).toURL()));
 				} 
 				catch (Exception x)
 				{
@@ -714,7 +714,7 @@
 			    Element cpDirElement = (Element) cpDirObject;
 			    try 
 			    {
-			        File cpFile = new File(cpDirElement.getText());
+			        File cpFile = new File(processPath(cpDirElement.getText()));
 			        if (!cpFile.isDirectory())
 			            throw new RuntimeException("The classpath component " + cpFile.getPath() + " is not a valid directory!");
 			        urlList.add(cpFile.toURL());			        
@@ -1009,4 +1009,16 @@
 	    }
 	    return methods;
 	}
+
+    public String processPath(String path)
+    {
+        if (path.startsWith("~"))
+        {
+            return path.replaceFirst("~", System.getProperty("user.home"));
+        }
+        else
+        {
+            return path;
+        }
+    }
 }
\ No newline at end of file
CVSspam 0.2.8