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:
parent
d906255cbb
commit
a7aa843bcc
1 changed files with 2 additions and 2 deletions
|
|
@ -72,11 +72,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
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())
|
||||
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)
|
||||
input_stream = make<Compress::GzipDecompressor>(move(input_stream));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue