From 75477ac5cd0d33d3476cc645c61dbd059040862a Mon Sep 17 00:00:00 2001 From: Julian Gilbey Date: Thu, 11 Jan 2024 13:25:55 +0000 Subject: [PATCH] Fix renamed_tree on Windows --- spyder/plugins/editor/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/editor/plugin.py b/spyder/plugins/editor/plugin.py index d0e564727b2..43a2d2c3981 100644 --- a/spyder/plugins/editor/plugin.py +++ b/spyder/plugins/editor/plugin.py @@ -2539,7 +2539,9 @@ def renamed_tree(self, source, dest): tofile = to_text_string(dest) for fname in self.get_filenames(): if osp.abspath(fname).startswith(dirname): - new_filename = fname.replace(dirname, tofile) + source_re = "^" + re.escape(source) + dest_quoted = dest.replace("\\", r"\\") + new_filename = re.sub(source_re, dest_quoted, fname) self.renamed(source=fname, dest=new_filename) #------ Source code