Browse Source

add an option to extract specified component

pull/175/head
crackedmind 2 years ago
parent
commit
d0a77a93dd
  1. 18
      src/cli/extract.cpp
  2. 1
      src/cli/extract.hpp
  3. 7
      src/cli/main.cpp

18
src/cli/extract.cpp

@ -633,7 +633,7 @@ bool print_file_info(const extract_options & o, const setup::info & info) {
if(!o.quiet && multiple_sections) {
std::cout << '\n';
}
if(o.list_languages) {
if(o.silent) {
BOOST_FOREACH(const setup::language_entry & language, info.languages) {
@ -768,7 +768,13 @@ processed_entries filter_entries(const extract_options & o, const setup::info &
} else if(o.language_only) {
continue; // Ignore language-agnostic dirs
}
if(!directory.components.empty()) {
if(!o.component.empty() && !setup::expression_match(o.component, directory.components)) {
continue;
}
}
std::string path = o.filenames.convert(directory.name);
if(path.empty()) {
continue; // Don't know what to do with this
@ -813,7 +819,13 @@ processed_entries filter_entries(const extract_options & o, const setup::info &
} else if(o.language_only) {
continue; // Ignore language-agnostic files
}
if (!file.components.empty()) {
if (!o.component.empty() && !setup::expression_match(o.component, file.components)) {
continue;
}
}
std::string path = o.filenames.convert(file.destination);
if(path.empty()) {
continue; // Internal file, not extracted

1
src/cli/extract.hpp

@ -77,6 +77,7 @@ struct extract_options {
bool extract_unknown; //!< Try to extract unknown Inno Setup versions
std::string component; //!< Extract only files for this component
bool extract_temp; //!< Extract temporary files
bool language_only; //!< Extract files not associated with any language
std::string language; //!< Extract only files for this language

7
src/cli/main.cpp

@ -165,6 +165,7 @@ int main(int argc, char * argv[]) {
po::options_description filter("Filters");
filter.add_options()
("component", po::value<std::string>(), "Extract only files for this component")
("exclude-temp,m", "Don't extract temporary files")
("language", po::value<std::string>(), "Extract only files for this language")
("language-only", "Only extract language-specific files")
@ -355,6 +356,12 @@ int main(int argc, char * argv[]) {
}
o.language_only = (options.count("language-only") != 0);
}
{
po::variables_map::const_iterator i = options.find("component");
if(i != options.end()) {
o.component = i->second.as<std::string>();
}
}
{
po::variables_map::const_iterator i = options.find("include");
if(i != options.end()) {

Loading…
Cancel
Save