1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:07:35 +00:00

Userland: gunzip if filename doesn't end in .gz append it.

This is the behaviour of gzip on my Linux system.
This commit is contained in:
asynts 2020-09-07 19:09:21 +02:00 committed by Andreas Kling
parent 049f709d0b
commit b0ba7a897f

View file

@ -55,8 +55,9 @@ int main(int argc, char** argv)
if (write_to_stdout) if (write_to_stdout)
keep_input_files = true; keep_input_files = true;
for (StringView filename : filenames) { for (String filename : filenames) {
ASSERT(filename.ends_with(".gz")); if (!filename.ends_with(".gz"))
filename = String::format("%s.gz", filename);
const auto input_filename = filename; const auto input_filename = filename;
const auto output_filename = filename.substring_view(0, filename.length() - 3); const auto output_filename = filename.substring_view(0, filename.length() - 3);