Skip to content

Commit

Permalink
Fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AVMatthews committed Jan 16, 2025
1 parent 5fc76ed commit 680f1e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
17 changes: 12 additions & 5 deletions components/core/src/clp_s/CommandLineArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,14 +824,15 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) {
}
} else if ((char)Command::JsonToIr == command_input) {
po::options_description compression_positional_options;
std::vector<std::string> input_paths;
// clang-format off
compression_positional_options.add_options()(
"ir-dir",
"irs-dir",
po::value<std::string>(&m_archives_dir)->value_name("DIR"),
"output directory"
)(
"input-paths",
po::value<std::vector<std::string>>(&m_file_paths)->value_name("PATHS"),
po::value<std::vector<std::string>>(&input_paths)->value_name("PATHS"),
"input paths"
);
// clang-format on
Expand Down Expand Up @@ -869,7 +870,7 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) {
// clang-format on

po::positional_options_description positional_options;
positional_options.add("ir-dir", 1);
positional_options.add("irs-dir", 1);
positional_options.add("input-paths", -1);

po::options_description all_compression_options;
Expand Down Expand Up @@ -907,13 +908,19 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) {
}

if (false == input_path_list_file_path.empty()) {
if (false == read_paths_from_file(input_path_list_file_path, m_file_paths)) {
if (false == read_paths_from_file(input_path_list_file_path, input_paths)) {
SPDLOG_ERROR("Failed to read paths from {}", input_path_list_file_path);
return ParsingResult::Failure;
}
}

if (m_file_paths.empty()) {
for (auto const& path : input_paths) {
if (false == get_input_files_for_raw_path(path, m_input_paths)) {
throw std::invalid_argument(fmt::format("Invalid input path \"{}\".", path));
}
}

if (m_input_paths.empty()) {
throw std::invalid_argument("No input paths specified.");
}

Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/JsonParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct JsonParserOption {
};

struct JsonToIrParserOption {
std::vector<std::string> file_paths;
std::vector<Path> input_paths;
std::string irs_dir;
size_t max_document_size;
size_t max_ir_buffer_size;
Expand Down
11 changes: 3 additions & 8 deletions components/core/src/clp_s/clp-s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,16 @@ auto generate_ir(CommandLineArguments const& command_line_arguments) -> bool {
return false;
}
clp_s::JsonToIrParserOption option{};
option.file_paths = command_line_arguments.get_file_paths();
option.input_paths = command_line_arguments.get_input_paths();
option.irs_dir = irs_dir.string();
option.max_document_size = command_line_arguments.get_max_document_size();
option.max_ir_buffer_size = command_line_arguments.get_max_ir_buffer_size();
option.compression_level = command_line_arguments.get_compression_level();
option.encoding = command_line_arguments.get_encoding_type();

if (false == clp_s::FileUtils::validate_path(option.file_paths)) {
SPDLOG_ERROR("Invalid file path(s) provided");
return false;
}

std::vector<std::string> all_file_paths;
for (auto& file_path : option.file_paths) {
clp_s::FileUtils::find_all_files(file_path, all_file_paths);
for (auto const& path : option.input_paths) {
all_file_paths.push_back(path.path);
}

for (auto& path : all_file_paths) {
Expand Down

0 comments on commit 680f1e3

Please sign in to comment.