diff --git a/include/flamegpu/io/LoggerFactory.h b/include/flamegpu/io/LoggerFactory.h index 1775739c7..ea519b2a0 100644 --- a/include/flamegpu/io/LoggerFactory.h +++ b/include/flamegpu/io/LoggerFactory.h @@ -31,9 +31,12 @@ class LoggerFactory { return std::make_unique(output_path, prettyPrint, truncateFile); } else if (extension == ".json") { return std::make_unique(output_path, prettyPrint, truncateFile); + } else if (extension.empty()) { + THROW exception::InvalidFilePath("Filepath '%s' contains unsuitable characters or lacks a file extension, " + "in LoggerFactory::createLogger().", output_path.c_str()); } THROW exception::UnsupportedFileType("File '%s' is not a type which can be written " - "by StateWriterFactory::createLogger().", + "by LoggerFactory::createLogger().", output_path.c_str()); } }; diff --git a/include/flamegpu/io/StateReaderFactory.h b/include/flamegpu/io/StateReaderFactory.h index 229750624..a5cfd78ca 100644 --- a/include/flamegpu/io/StateReaderFactory.h +++ b/include/flamegpu/io/StateReaderFactory.h @@ -37,6 +37,9 @@ class StateReaderFactory { return new XMLStateReader(); } else if (extension == ".json") { return new JSONStateReader(); + } else if (extension.empty()) { + THROW exception::InvalidFilePath("Filepath '%s' contains unsuitable characters or lacks a file extension, " + "in StateReaderFactory::createLogger().", input.c_str()); } THROW exception::UnsupportedFileType("File '%s' is not a type which can be read " "by StateReaderFactory::createReader().", diff --git a/include/flamegpu/io/StateWriterFactory.h b/include/flamegpu/io/StateWriterFactory.h index 02a3a5f9e..4e1c5d2a8 100644 --- a/include/flamegpu/io/StateWriterFactory.h +++ b/include/flamegpu/io/StateWriterFactory.h @@ -32,6 +32,9 @@ class StateWriterFactory { return new XMLStateWriter(); } else if (extension == ".json") { return new JSONStateWriter(); + } else if (extension.empty()) { + THROW exception::InvalidFilePath("Filepath '%s' contains unsuitable characters or lacks a file extension, " + "in StateWriterFactory::createLogger().", output_file.c_str()); } THROW exception::UnsupportedFileType("File '%s' is not a type which can be written " "by StateWriterFactory::createWriter().",