make archive output filenames more reasonable
This commit is contained in:
+6
-4
@@ -1228,8 +1228,10 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
case Behavior::EXTRACT_GSL:
|
case Behavior::EXTRACT_GSL:
|
||||||
case Behavior::EXTRACT_BML: {
|
case Behavior::EXTRACT_BML: {
|
||||||
|
string output_prefix;
|
||||||
if (!output_filename) {
|
if (!output_filename) {
|
||||||
output_filename = "";
|
output_prefix = input_filename;
|
||||||
|
output_prefix.push_back('_');
|
||||||
} else if (!strcmp(output_filename, "-")) {
|
} else if (!strcmp(output_filename, "-")) {
|
||||||
throw invalid_argument("output prefix cannot be stdout");
|
throw invalid_argument("output prefix cannot be stdout");
|
||||||
}
|
}
|
||||||
@@ -1241,7 +1243,7 @@ int main(int argc, char** argv) {
|
|||||||
GSLArchive arch(data_shared, big_endian);
|
GSLArchive arch(data_shared, big_endian);
|
||||||
for (const auto& entry_it : arch.all_entries()) {
|
for (const auto& entry_it : arch.all_entries()) {
|
||||||
auto e = arch.get(entry_it.first);
|
auto e = arch.get(entry_it.first);
|
||||||
string out_file = output_filename + entry_it.first;
|
string out_file = output_prefix + entry_it.first;
|
||||||
save_file(out_file.c_str(), e.first, e.second);
|
save_file(out_file.c_str(), e.first, e.second);
|
||||||
fprintf(stderr, "... %s\n", out_file.c_str());
|
fprintf(stderr, "... %s\n", out_file.c_str());
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1253,7 @@ int main(int argc, char** argv) {
|
|||||||
{
|
{
|
||||||
auto e = arch.get(entry_it.first);
|
auto e = arch.get(entry_it.first);
|
||||||
string data = prs_decompress(e.first, e.second);
|
string data = prs_decompress(e.first, e.second);
|
||||||
string out_file = output_filename + entry_it.first;
|
string out_file = output_prefix + entry_it.first;
|
||||||
save_file(out_file, data);
|
save_file(out_file, data);
|
||||||
fprintf(stderr, "... %s\n", out_file.c_str());
|
fprintf(stderr, "... %s\n", out_file.c_str());
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1261,7 @@ int main(int argc, char** argv) {
|
|||||||
auto gvm_e = arch.get_gvm(entry_it.first);
|
auto gvm_e = arch.get_gvm(entry_it.first);
|
||||||
if (gvm_e.second) {
|
if (gvm_e.second) {
|
||||||
string data = prs_decompress(gvm_e.first, gvm_e.second);
|
string data = prs_decompress(gvm_e.first, gvm_e.second);
|
||||||
string out_file = output_filename + entry_it.first + ".gvm";
|
string out_file = output_prefix + entry_it.first + ".gvm";
|
||||||
save_file(out_file, data);
|
save_file(out_file, data);
|
||||||
fprintf(stderr, "... %s\n", out_file.c_str());
|
fprintf(stderr, "... %s\n", out_file.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user