Skip to content

Commit

Permalink
Use absolute instead of resolve for symlink name; backup symlinks as …
Browse files Browse the repository at this point in the history
…symlinks
  • Loading branch information
RagnarGrootKoerkamp committed Mar 8, 2024
1 parent 2c5d465 commit 4ad82b9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions bin/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,14 +1566,10 @@ def generate_copies_and_includes(d):
def remove(self, src):
if self.trashdir is None:
self.trashdir = self.problem.tmpdir / secrets.token_hex(4)
assert src.is_relative_to(self.problem.path / 'data')
dst = self.trashdir / src.relative_to((self.problem.path / 'data'))
dst = self.trashdir / src.absolute().relative_to((self.problem.path / 'data').absolute())
dst.parent.mkdir(parents=True, exist_ok=True)

def copy(src, dst):
shutil.copy2(src, dst, follow_symlinks=False)

shutil.move(src, dst, copy)
shutil.move(src, dst)

def _remove_unknown(self, path, bar, silent=False):
local = path.relative_to(self.problem.path / 'data')
Expand Down

0 comments on commit 4ad82b9

Please sign in to comment.