Skip to content

Commit

Permalink
Revert symlink resolving in add_{symlink,copy}_layer (#408)
Browse files Browse the repository at this point in the history
* revert symlink resolve in dataset functions

* revert black changes

* update changelog

* make path absolute for Layer as well

* avoid code duplication

* fix typing
  • Loading branch information
daniel-wer authored Sep 7, 2021
1 parent 6832c09 commit f8a246b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions webknossos/webknossos/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,8 @@ def add_symlink_layer(
if isinstance(foreign_layer, Layer):
foreign_layer_path = foreign_layer.path
else:
foreign_layer_path = Path(foreign_layer).absolute()
foreign_layer_path = Path(foreign_layer)

foreign_layer_path = foreign_layer_path.resolve()
layer_name = foreign_layer_path.name
if layer_name in self.layers.keys():
raise IndexError(
Expand All @@ -410,7 +409,7 @@ def add_symlink_layer(
foreign_layer_symlink_path = (
Path(os.path.relpath(foreign_layer_path, self.path))
if make_relative
else foreign_layer_path
else Path(os.path.abspath(foreign_layer_path))
)
os.symlink(foreign_layer_symlink_path, join(self.path, layer_name))
original_layer = Dataset(foreign_layer_path.parent).get_layer(layer_name)
Expand All @@ -434,7 +433,7 @@ def add_copy_layer(self, foreign_layer: Union[str, Path, Layer]) -> Layer:
else:
foreign_layer_path = Path(foreign_layer)

foreign_layer_path = foreign_layer_path.resolve()
foreign_layer_path = Path(os.path.abspath(foreign_layer_path))
layer_name = foreign_layer_path.name
if layer_name in self.layers.keys():
raise IndexError(
Expand Down
1 change: 1 addition & 0 deletions wkcuber/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For upgrade instructions, please check the respective *Breaking Changes* section
### Changed

### Fixed
- Reverted that `dataset.add_symlink_layer` and `dataset.add_copy_layer` resolved the layer path if it was a symlink. [#408](https://github.com/scalableminds/webknossos-libs/pull/408)

## [0.8.13](https://github.com/scalableminds/webknossos-cuber/releases/tag/v0.8.13) - 2021-09-01
[Commits](https://github.com/scalableminds/webknossos-cuber/compare/v0.8.12...v0.8.13)
Expand Down

0 comments on commit f8a246b

Please sign in to comment.