diff --git a/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp b/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
index 2f03ce3..4ac1817 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/DataConverter.cpp
@@ -321,12 +321,11 @@ void DataConverter::_validateInput(const QStringList& inputs, const QString& out
throw HootException("Read limit may only be specified when converting OGR inputs.");
}
- QFileInfo outputInfo(output);
- LOG_VARD(outputInfo.dir().absolutePath());
- const bool outputDirSuccess = QDir().mkpath(outputInfo.dir().absolutePath());
- if (!outputDirSuccess)
+ if (!IoUtils::isUrl(output))
{
- throw IllegalArgumentException("Unable to create output path for: " + output);
+ // write the output dir now so we don't get a nasty surprise at the end of a long job that it
+ // can't be written
+ IoUtils::writeOutputDir(output);
}
}
@@ -430,6 +429,19 @@ void DataConverter::_convertToOgr(const QString& input, const QString& output)
"OGR output...");
}
+ // Set a config option so the translation script knows what the output format is
+ // For this, output format == file extension
+ // We are going to grab everything after the last "." in the output file name and use it as the file extension
+ QString outputFormat = "";
+ if (output.lastIndexOf(".") > -1)
+ {
+ outputFormat = output.right(output.size() - output.lastIndexOf(".") - 1).toLower();
+ }
+ conf().set(ConfigOptions::getOgrOutputFormatKey(), outputFormat);
+
+ LOG_DEBUG(conf().getString(ConfigOptions::getOgrOutputFormatKey()));
+
+
// Translation for going to OGR is always required and happens in the writer itself. It is not to
// be done with convert ops, so let's ignore any translation ops that were specified.
_convertOps.removeAll(QString::fromStdString(SchemaTranslationOp::className()));