Skip to content

Commit

Permalink
fix: clean up target path upon storage in order to avoid merges of di…
Browse files Browse the repository at this point in the history
…rectories.
  • Loading branch information
johanneskoester committed Aug 16, 2024
1 parent 0143cdd commit 114ad93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions snakemake_storage_plugin_fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ def store_object(self):
# Ensure that the object is stored at the location specified by
# self.local_path().
self.query_path.parent.mkdir(exist_ok=True, parents=True)
# Clean up the target path
if self.local_path().is_dir():
shutil.rmtree(self.query_path, ignore_errors=True)
else:
self.query_path.unlink(missing_ok=True)
# We want to respect the permissions in the target folder, in particular the
# setgid bit. Hence, we use --no-p to avoid preserving of permissions from the
# source to the target.
Expand Down

0 comments on commit 114ad93

Please sign in to comment.