refactor(get-modflow): use Path.replace instead of Path.rename #1822
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The behavior of
Path.rename()
is inconsistent between platforms: on Windows an error is raised if a file with the new name already exists, while on Linux and macOS the file is silently replaced. This PR updatesget-modflow
to usePath.replace()
instead ofPath.rename()
when moving binaries from the download directory to bin directory, for consistent behavior.One case for which this is relevant is installing a full suite of binaries from the
executables
distribution, plus bleeding-edge versions ofmf6
,mf5to6
,mf2005
, andzbud6
from themodflow6-nightly-build
distribution. An easy way to do this is runningget-modflow
twice, e.g.Currently this works on macOS and Linux but not on Windows.