private File createFolder(ITestResult tr) throws IOException{
		
		String path = ListenerGateway.getParameter(SCREENSHOT_FOLDER);

		if (path == null || path.isEmpty()) {
			path = "." + File.separatorChar + "screenshots";
		}

		if(tr != null) {
			path += File.separatorChar + tr.getMethod().getTestClass().getName();
		}

		File screenshotFolder = new File(path);
		if (!screenshotFolder.exists() && !screenshotFolder.mkdirs()){
			throw new IOException(ErrorMessages.ERROR_FOLDER_CANNOT_BE_CREATED);
		}
		
		return screenshotFolder;
	}
private File createFolder ( ITestResult tr ) throws IOException { String path = ListenerGateway . getParameter ( SCREENSHOT_FOLDER ) ; if ( path == null || path . isEmpty ( ) ) { path = "." + File . separatorChar + "screenshots" ; } if ( tr != null ) { path += File . separatorChar + tr . getMethod ( ) . getTestClass ( ) . getName ( ) ; } File screenshotFolder = new File ( path ) ; if ( ! screenshotFolder . exists ( ) && ! screenshotFolder . mkdirs ( ) ) { throw new IOException ( ErrorMessages . ERROR_FOLDER_CANNOT_BE_CREATED ) ; } return screenshotFolder ; }
Generate, if it doesn't exist, the folder for screenshots taken. The user can pass this information by parameter in the
testng.xml. If it's not passed this information, the folder is created in the current location with the name 'screenshots'.
@param tr	Test Result
@return	Screenshot Folder
@throws IOException