Skip to content

Commit 7905f9d

Browse files
committed
Add to readme
1 parent 3dfa3fd commit 7905f9d

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Readme.adoc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,8 @@ def apply(dest: os.Path,
12331233
includePatterns: Seq[Regex] = List(),
12341234
preserveMtimes: Boolean = false,
12351235
deletePatterns: Seq[Regex] = List(),
1236-
compressionLevel: Int = -1 /* 0-9 */): os.Path
1236+
compressionLevel: Int = -1, /* 0-9 */
1237+
followLinks: Boolean = true): os.Path
12371238
----
12381239

12391240
The zip object provides functionality to create or modify zip archives. It supports:
@@ -1243,14 +1244,19 @@ The zip object provides functionality to create or modify zip archives. It suppo
12431244
- Exclude Patterns (-x): You can specify files or patterns to exclude while zipping.
12441245
- Include Patterns (-i): You can include specific files or patterns while zipping.
12451246
- Delete Patterns (-d): You can delete specific files from an existing zip archive.
1246-
- Configuring whether or not to preserve filesyste mtimes and permissions
1247+
- Symbolic Links (-y): You can configure to zip symbolic links as the referenced files, which is the default, or as symbolic links, by setting `followLinks = false`.
1248+
- Configuring whether or not to preserve filesyste mtimes.
1249+
- Preserving Unix file permissions.
12471250

12481251
This will create a new zip archive at `dest` containing `file1.txt` and everything
12491252
inside `sources`. If `dest` already exists as a zip, the files will be appended to the
12501253
existing zip, and any existing zip entries matching `deletePatterns` will be removed.
12511254

1252-
Note that `os.zip` doesn't support creating/unpacking symlinks or filesystem permissions
1253-
in Zip files, because the underlying `java.util.zip.Zip*Stream` doesn't support them.
1255+
When modifying an existing zip file,
1256+
- Unix file permissions will be preserved if Java Runtime Version >= 14.
1257+
- If using Java Runtime Version < 14, Unix file permissions are not preserved, even for existing zip entries.
1258+
- Symbolics links will always be stored as the referenced files.
1259+
- Existing symbolic links stored in the zip might lose their symbolic link file type field and become broken.
12541260

12551261
===== Zipping Files and Folders
12561262

@@ -1375,6 +1381,8 @@ assert(paths == Seq(unzippedFolder / "File.txt"))
13751381
This can be useful for streaming the zipped data to places which are not files:
13761382
over the network, over a pipe, etc.
13771383

1384+
File permissions will be preserved. By default, symbolic links will be zipped as the referenced files. Set `followLinks = false` to zip them as symbolic links.
1385+
13781386
==== `os.unzip`
13791387

13801388
===== Unzipping Files
@@ -1384,7 +1392,7 @@ over the network, over a pipe, etc.
13841392
os.unzip(os.Path("/path/to/archive.zip"), Some(os.Path("/path/to/destination")))
13851393
----
13861394

1387-
This extracts the contents of `archive.zip` to the specified destination.
1395+
This extracts the contents of `archive.zip` to the specified destination. It supports preserving file permissions and symbolic links.
13881396

13891397

13901398
===== Excluding Files While Unzipping
@@ -1407,7 +1415,7 @@ You can list the contents of the zip file without extracting them:
14071415
os.unzip.list(os.Path("/path/to/archive.zip"))
14081416
----
14091417

1410-
This will print all the file paths contained in the zip archive.
1418+
This will print all the file paths contained in the zip archive. File permissions and symbolic links will not be preserved.
14111419

14121420
==== `os.unzip.stream`
14131421

@@ -1464,6 +1472,8 @@ finally zipFile3.close()
14641472
of the zip file rather than a bare path on the filesystem. Note that you need to call `ZipRoot#close()`
14651473
when you are done with it to avoid leaking filesystem resources.
14661474

1475+
File permissions are only supported for Java Runtime Version >= 14. Symbolic links are not supported. Using `os.zip.open` on a zip archive that contains symbolic links might break the links.
1476+
14671477
=== Filesystem Metadata
14681478

14691479
==== `os.stat`
@@ -1793,7 +1803,7 @@ is run:
17931803

17941804
* `cwd`: the working directory of the subprocess
17951805
* `env`: any additional environment variables you wish to set in the subprocess
1796-
in addition to those passed via `propagateEnv`. You can also set their values
1806+
in addition to those passed via `propagateEnv`. You can also set their values
17971807
to `null` to remove specific variables.
17981808
* `stdin`: any data you wish to pass to the subprocess's standard input
17991809
* `stdout`/`stderr`: these are ``os.Redirect``s that let you configure how the

0 commit comments

Comments
 (0)