diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 9203f2d4ed..d31bd03adf 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -156,7 +156,7 @@ target_link_libraries(uptime LibMain) target_link_libraries(userdel LibMain) target_link_libraries(usermod LibMain) target_link_libraries(utmpupdate LibMain) -target_link_libraries(zip LibArchive LibCompress LibCrypto) +target_link_libraries(zip LibArchive LibCompress LibCrypto LibMain) target_link_libraries(cpp-lexer LibCpp) target_link_libraries(cpp-parser LibCpp LibGUI) target_link_libraries(cpp-preprocessor LibCpp LibGUI) diff --git a/Userland/Utilities/zip.cpp b/Userland/Utilities/zip.cpp index 0f68c8f304..6dce8adc18 100644 --- a/Userland/Utilities/zip.cpp +++ b/Userland/Utilities/zip.cpp @@ -13,7 +13,7 @@ #include #include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { const char* zip_path; Vector source_paths; @@ -25,7 +25,7 @@ int main(int argc, char** argv) args_parser.add_positional_argument(source_paths, "Input files to be archived", "files", Core::ArgsParser::Required::Yes); args_parser.add_option(recurse, "Travel the directory structure recursively", "recurse-paths", 'r'); args_parser.add_option(force, "Overwrite existing zip file", "force", 'f'); - args_parser.parse(argc, argv); + args_parser.parse(arguments); String zip_file_path { zip_path }; if (Core::File::exists(zip_file_path)) { @@ -37,15 +37,10 @@ int main(int argc, char** argv) } } - auto file_stream_or_error = Core::OutputFileStream::open(zip_file_path); - if (file_stream_or_error.is_error()) { - warnln("Failed to open zip file: {}", file_stream_or_error.error()); - return 1; - } + auto file_stream = TRY(Core::OutputFileStream::open(zip_file_path)); outln("Archive: {}", zip_file_path); - auto file_stream = file_stream_or_error.value(); Archive::ZipOutputStream zip_stream { file_stream }; auto add_file = [&](String path) {