@@ -52,41 +52,6 @@ static std::shared_ptr<middle_t> create_middle(options_t const &options)
5252 return std::make_shared<middle_ram_t >(&options);
5353}
5454
55- /* *
56- * Prepare input file(s). Does format checks as far as this is possible
57- * without actually opening the files.
58- */
59- static std::vector<osmium::io::File>
60- prepare_input_files (options_t const &options)
61- {
62- std::vector<osmium::io::File> files;
63-
64- for (auto const &filename : options.input_files ) {
65- osmium::io::File file{filename, options.input_format };
66-
67- if (file.format () == osmium::io::file_format::unknown) {
68- if (options.input_format .empty ()) {
69- throw std::runtime_error{
70- " Cannot detect file format for '{}'. Try using -r." _format (
71- filename)};
72- }
73- throw std::runtime_error{
74- " Unknown file format '{}'." _format (options.input_format )};
75- }
76-
77- if (!options.append && file.has_multiple_object_versions ()) {
78- throw std::runtime_error{
79- " Reading an OSM change file only works in append mode." };
80- }
81-
82- log_debug (" Reading file: {}" , filename);
83-
84- files.emplace_back (file);
85- }
86-
87- return files;
88- }
89-
9055int main (int argc, char *argv[])
9156{
9257 try {
@@ -99,7 +64,8 @@ int main(int argc, char *argv[])
9964
10065 check_db (options);
10166
102- auto const files = prepare_input_files (options);
67+ auto const files = prepare_input_files (
68+ options.input_files , options.input_format , options.append );
10369
10470 auto middle = create_middle (options);
10571 middle->start ();
0 commit comments