mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Utilities/tar: Open archive file before changing directory
Otherwise the utility will fail to open the archive file because it's presumably not in the chosen directory.
This commit is contained in:
@@ -72,11 +72,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (list || extract) {
|
if (list || extract) {
|
||||||
|
NonnullOwnPtr<Stream> input_stream = TRY(Core::InputBufferedFile::create(TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read))));
|
||||||
|
|
||||||
if (!directory.is_empty())
|
if (!directory.is_empty())
|
||||||
TRY(Core::System::chdir(directory));
|
TRY(Core::System::chdir(directory));
|
||||||
|
|
||||||
NonnullOwnPtr<Stream> input_stream = TRY(Core::InputBufferedFile::create(TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read))));
|
|
||||||
|
|
||||||
if (gzip)
|
if (gzip)
|
||||||
input_stream = make<Compress::GzipDecompressor>(move(input_stream));
|
input_stream = make<Compress::GzipDecompressor>(move(input_stream));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user