You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2003/11/17 18:58:26 UTC

cvs commit: jakarta-jmeter/src/core/org/apache/jmeter NewDriver.java

sebb        2003/11/17 09:58:26

  Modified:    src/core/org/apache/jmeter NewDriver.java
  Log:
  Fixup to allow JMeter to run from a UNC directory
  
  Revision  Changes    Path
  1.5       +27 -3     jakarta-jmeter/src/core/org/apache/jmeter/NewDriver.java
  
  Index: NewDriver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/NewDriver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NewDriver.java	15 Jun 2003 18:07:26 -0000	1.4
  +++ NewDriver.java	17 Nov 2003 17:58:26 -0000	1.5
  @@ -100,6 +100,12 @@
               jmDir = userDir.getAbsoluteFile().getParent();
           }
   
  +        /*
  +         * Does the system support UNC paths?
  +         * If so, may need to fix them up later
  +         */
  +		boolean usesUNC = System.getProperty("os.name").startsWith("Windows");
  +		
           StringBuffer classpath = new StringBuffer();
           File[] libDirs =
               new File[] {
  @@ -119,9 +125,27 @@
               {
                   try
                   {
  -                    jars.add(new URL("file", "", libJars[i].getPath()));
  +                	String s = libJars[i].getPath();
  +                	
  +                	// Fix path to allow the use of UNC URLs
  +                	if (usesUNC){
  +						if (s.startsWith("\\\\") &&
  +						   !s.startsWith("\\\\\\")
  +						   )
  +						{
  +							s = "\\\\" + s;
  +						} 
  +						else if (s.startsWith("//") &&
  +						        !s.startsWith("///")
  +						        )
  +						 {
  +						     s = "//" + s;
  +						 }
  +                	} // usesUNC
  +
  +                    jars.add(new URL("file", "", s));
                       classpath.append(System.getProperty("path.separator"));
  -                    classpath.append(libJars[i].getPath());
  +                    classpath.append(s);
                   }
                   catch (MalformedURLException e)
                   {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org