### Eclipse Workspace Patch 1.0 #P jmeterSVN Index: src/core/org/apache/jmeter/reporters/ResultCollector.java =================================================================== --- src/core/org/apache/jmeter/reporters/ResultCollector.java (revision 964795) +++ src/core/org/apache/jmeter/reporters/ResultCollector.java (working copy) @@ -46,10 +46,12 @@ import org.apache.jmeter.samplers.SampleSaveConfiguration; import org.apache.jmeter.save.CSVSaveService; import org.apache.jmeter.save.SaveService; +import org.apache.jmeter.services.FileServer; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.TestListener; import org.apache.jmeter.testelement.property.BooleanProperty; import org.apache.jmeter.testelement.property.ObjectProperty; +import org.apache.jmeter.util.JMeterUtils; import org.apache.jmeter.visualizers.Visualizer; import org.apache.jorphan.logging.LoggingManager; import org.apache.jorphan.util.JMeterError; @@ -99,6 +101,12 @@ //@GuardedBy("LOCK") private static final Map files = new HashMap(); + /** + * JMeter property that determines if the path is relative to the + * script or the launch directory + */ + private static final String PATH_RELATIVE_TO = "path.relative.to"; + /* * Keep track of the file writer and the configuration, * as the instance used to close them is not the same as the instance that creates @@ -291,6 +299,16 @@ boolean parsedOK = false; String filename = getFilename(); File file = new File(filename); + String pathProperty = JMeterUtils.getProperty(PATH_RELATIVE_TO); + + if(pathProperty != null && "script".equalsIgnoreCase(pathProperty)){ + if(!file.isAbsolute()){ + log.info("loading file with relative path: " +filename); + file = new File(FileServer.getFileServer().getBaseDir(), filename); + log.info("file path set to: "+filename); + } + } + if (file.exists()) { BufferedReader dataReader = null; BufferedInputStream bufferedInputStream = null; @@ -375,6 +393,16 @@ if (filename == null || filename.length() == 0) { return null; } + File file = new File(filename); + String pathProperty = JMeterUtils.getProperty(PATH_RELATIVE_TO); + + if(pathProperty != null && "script".equalsIgnoreCase(pathProperty)){ + if(!file.isAbsolute()){ + log.info("loading file with relative path: " +filename); + filename = FileServer.getFileServer().getBaseDir() +File.separator+ filename; + log.info("file path set to: "+filename); + } + } FileEntry fe = files.get(filename); PrintWriter writer = null; boolean trimmed = true; Index: bin/jmeter.properties =================================================================== --- bin/jmeter.properties (revision 964795) +++ bin/jmeter.properties (working copy) @@ -364,6 +364,11 @@ # Optional xml processing instruction for line 2 of the file: #jmeter.save.saveservice.xml_pi= +# Optional setting to determine if the path in the results file is relative to the script or the launch directory +# Accepted values: script, launch.directory +# Other entries default to launch.directory +path.relative.to=launch.directory + #--------------------------------------------------------------------------- # Settings that affect SampleResults #---------------------------------------------------------------------------