Skip to content

Commit ee266b1

Browse files
committed
#1 resolve complete path to screenshot.dir
1 parent 17b9bd0 commit ee266b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/aventstack/extentreports/cucumber/adapter/ExtentCucumberAdapter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.OutputStream;
66
import java.net.URISyntaxException;
77
import java.net.URL;
8+
import java.nio.file.Paths;
89
import java.util.ArrayList;
910
import java.util.HashMap;
1011
import java.util.List;
@@ -205,8 +206,9 @@ private static OutputStream createReportFileOutputStream(URL url) {
205206
private URL toUrl(String fileName) {
206207
try {
207208
Object prop = ExtentService.getProperty(SCREENSHOT_DIR_PROPERTY);
208-
String screenshotDir = prop == null ? "test-output/" : String.valueOf(prop);
209-
return new URL(new File(screenshotDir).toURI().toURL(), fileName);
209+
String screenshotDir = prop == null ? "test-output/" : String.valueOf(prop);
210+
URL url = Paths.get(screenshotDir, fileName).toUri().toURL();
211+
return url;
210212
} catch (IOException e) {
211213
throw new CucumberException(e);
212214
}

0 commit comments

Comments
 (0)