diff --git a/src/tar.toit b/src/tar.toit index a82f916..0f581bb 100644 --- a/src/tar.toit +++ b/src/tar.toit @@ -1,4 +1,4 @@ -// Copyright (C) 2019 Toitware ApS. All rights reserved. +// Copyright (C) 2026 Toit contributors. // Use of this source code is governed by an MIT-style license that can be // found in the package's LICENSE file. @@ -14,15 +14,9 @@ class Tar: /** Creates a new Tar archiver that writes to the given $writer. - - The $writer should be an $io.Writer, but for compatibility reasons, it can also be an - "old-style" writer. The old-style writer is deprecated and will be removed in the future. */ - constructor writer: - if writer is io.Writer: - writer_ = writer - else: - writer_ = io.Writer.adapt writer + constructor writer/io.Writer: + writer_ = writer /** Adds a new "file" to the generated tar-archive. @@ -34,15 +28,13 @@ class Tar: add_ file-name content --permissions=permissions /** - Closes the tar stream, and invokes 'close' on the writer if $close-writer is - true (the default). + Closes the tar stream, but does not close the writer. */ - close --close-writer/bool=true: + close: // TODO(florian): feels heavy to allocate a new array just to write a bunch of zeros. zero-header := ByteArray 512 writer_.write zero-header writer_.write zero-header - if close-writer: (writer_ as io.CloseableWriter).close /** Adds the given $file-name with its $content to the tar stream. diff --git a/tests/basic-test.toit b/tests/basic-test.toit index 65a75da..c97362f 100644 --- a/tests/basic-test.toit +++ b/tests/basic-test.toit @@ -1,4 +1,4 @@ -// Copyright (C) 2019 Toitware ApS. +// Copyright (C) 2026 Toit contributors. // Use of this source code is governed by a Zero-Clause BSD license that can // be found in the tests/TESTS_LICENSE file. diff --git a/tests/long-name-test.toit b/tests/long-name-test.toit index e3546f4..28b7c47 100644 --- a/tests/long-name-test.toit +++ b/tests/long-name-test.toit @@ -1,4 +1,4 @@ -// Copyright (C) 2024 Toitware ApS. +// Copyright (C) 2026 Toit contributors. // Use of this source code is governed by a Zero-Clause BSD license that can // be found in the tests/TESTS_LICENSE file. diff --git a/tests/permissions-test.toit b/tests/permissions-test.toit index 828651f..2cbbe4f 100644 --- a/tests/permissions-test.toit +++ b/tests/permissions-test.toit @@ -1,4 +1,4 @@ -// Copyright (C) 2024 Toitware ApS. +// Copyright (C) 2026 Toit contributors. // Use of this source code is governed by a Zero-Clause BSD license that can // be found in the tests/TESTS_LICENSE file. diff --git a/tests/utils.toit b/tests/utils.toit index 06aa483..c57971e 100644 --- a/tests/utils.toit +++ b/tests/utils.toit @@ -48,6 +48,7 @@ run-tar command flags [generator]: latch.set result generator.call to.out + to.close return latch.get