Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Use .powsybl debug folder #72

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/test/java/com/powsybl/nad/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ protected String generateSvgString(Network network, Predicate<VoltageLevel> volt
}

private void writeToHomeDir(String refFilename, String svgString) {
try (OutputStream fos = new FileOutputStream(new File(System.getProperty("user.home"), refFilename))) {
fos.write(svgString.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new UncheckedIOException(e);
File debugFolder = new File(System.getProperty("user.home"), ".powsybl");
if (debugFolder.exists() || debugFolder.mkdir()) {
File file = new File(debugFolder, refFilename);
try (OutputStream fos = new FileOutputStream(file)) {
fos.write(svgString.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}

Expand Down