Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fs3
Browse files Browse the repository at this point in the history
  • Loading branch information
torzdf committed May 20, 2024
2 parents 527778b + 1f4fcff commit c58a24e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/align/alignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,15 @@ def backup(self) -> None:
now = datetime.now().strftime("%Y%m%d_%H%M%S")
src = self._file
split = os.path.splitext(src)
dst = split[0] + "_" + now + split[1]
dst = f"{split[0]}_{now}{split[1]}"
idx = 1
while True:
if not os.path.exists(dst):
break
logger.debug("Backup file %s exists. Incrementing", dst)
dst = f"{split[0]}_{now}({idx}){split[1]}"
idx += 1

logger.info("Backing up original alignments to '%s'", dst)
os.rename(src, dst)
logger.debug("Backed up alignments")

0 comments on commit c58a24e

Please sign in to comment.