Skip to content

Commit cd11c24

Browse files
committed
Correctly strip the string
1 parent 9991d5b commit cd11c24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

easybuild/tools/filetools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,8 @@ def back_up_file(src_file, backup_extension='bak', hidden=False, strip_fn=None):
20052005
fn_suffix = '.%s' % backup_extension
20062006

20072007
src_dir, src_fn = os.path.split(src_file)
2008-
if strip_fn:
2009-
src_fn = src_fn.rstrip(strip_fn)
2008+
if strip_fn and src_fn.endswith(strip_fn):
2009+
src_fn = src_fn[:-len(strip_fn)]
20102010

20112011
backup_fp = find_backup_name_candidate(os.path.join(src_dir, fn_prefix + src_fn + fn_suffix))
20122012

0 commit comments

Comments
 (0)