We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1b5c38 commit f59e9c1Copy full SHA for f59e9c1
nitrite/src/main/java/org/dizitart/no2/tool/Exporter.java
@@ -94,6 +94,18 @@ public void exportTo(String file) {
94
*/
95
public void exportTo(File file) {
96
try {
97
+ if (file.isDirectory()) {
98
+ throw new IOException(file.getPath() + " is not a file");
99
+ }
100
+
101
+ File parent = file.getParentFile();
102
+ // if parent dir does not exists, try to create it
103
+ if (!parent.exists()) {
104
+ boolean result = parent.mkdirs();
105
+ if (!result) {
106
+ throw new IOException("Failed to create parent directory " + parent.getPath());
107
108
109
exportTo(new FileOutputStream(file));
110
} catch (IOException ioe) {
111
throw new NitriteIOException(
0 commit comments