Skip to content

Commit 14574c7

Browse files
author
Roman Inflianskas
committed
stdlib/os: Add options argument to copy functions
Sometimes there is a need to copy symlinks as they are. This commit adds optional argument `options` to all copy functions in `os` module. `options` argument is an object for easier modification in the future. Also, bugs in `copyDir`, `copyDirWithPermissions`, `moveDir` functions are fixed: now symlinks are copied as they are (before this commit, they were skipped). Note: Inspired by https://docs.python.org/3/library/shutil.html#shutil.copy and https://en.cppreference.com/w/cpp/filesystem/copy_options
1 parent e4a5299 commit 14574c7

File tree

4 files changed

+302
-108
lines changed

4 files changed

+302
-108
lines changed

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ with other backends. see #9125. Use `-d:nimLegacyJsRound` for previous behavior.
109109

110110
- Removed the optional `longestMatch` parameter of the `critbits._WithPrefix` iterators (it never worked reliably)
111111

112+
- Added optional `options` argument to `copyFile`, `copyFileToDir`, `copyDir`,
113+
`copyFileWithPermissions`, and `copyDirWithPermissions`. By default,
114+
`copyFile`, `copyFileToDir`, `copyFileWithPermissions` follow the symlinks
115+
(copy files symlinks point to), and `copyDir`, `copyDirWithPermissions` copy
116+
symlinks as they are (instead of skipping them as it was before). Also,
117+
`moveFile` and `moveDir` now always move symlinks as they are.
118+
112119
## Language changes
113120

114121
- `nimscript` now handles `except Exception as e`.

0 commit comments

Comments
 (0)