aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-07-22 18:22:19 +0200
committerTristan Gingold <tgingold@free.fr>2021-07-22 18:22:19 +0200
commit6ec5bc7f0942919003406a04029b8c408efc1e8c (patch)
tree428c8cd967e72be13217c03cea2d3ae712ec942b /pyGHDL
parent9d94165c115ba44012f1bd9f488d3d3475c937ab (diff)
downloadghdl-6ec5bc7f0942919003406a04029b8c408efc1e8c.tar.gz
ghdl-6ec5bc7f0942919003406a04029b8c408efc1e8c.tar.bz2
ghdl-6ec5bc7f0942919003406a04029b8c408efc1e8c.zip
pyGHDL/cli/lsp.py: adjust previous patch in __rotate_log_files
Diffstat (limited to 'pyGHDL')
-rw-r--r--pyGHDL/cli/lsp.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/pyGHDL/cli/lsp.py b/pyGHDL/cli/lsp.py
index 7bd2d026d..8b149cdf3 100644
--- a/pyGHDL/cli/lsp.py
+++ b/pyGHDL/cli/lsp.py
@@ -62,18 +62,20 @@ def __rotate_log_files(basename: str, num: int):
# Remove the oldest file. This one will be lost.
# Required on Windows as it is an error to rename a file to an existing
# one.
- bname = Path(basename)
- oldfile = bname.with_suffix(str(num))
+ # Note: Path.with_suffix cannot be used as there might be multiple
+ # suffixes (like in trace.out.0).
+ oldfile = Path("{}.{}".format(basename, num))
if oldfile.is_file():
oldfile.unlink()
# Rotate old files
for i in range(num, 0, -1):
- oldfile = bname.with_suffix(str(i - 1))
+ oldfile = Path("{}.{}".format(basename, i - 1))
if oldfile.is_file():
- oldfile.rename(bname.with_suffix(str(i)))
+ oldfile.rename(Path("{}.{}".format(basename, i)))
# Rotate the newest log file.
+ bname = Path(basename)
if bname.is_file():
- bname.rename(bname.with_suffix(str(0)))
+ bname.rename(Path("{}.{}".format(basename, 0)))
def _generateCLIParser() -> ArgumentParser: