Skip to content

Commit 0d3d35e

Browse files
committed
-
1 parent 74fc6b3 commit 0d3d35e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source_py3/python_toolbox/file_tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
def _get_next_name(path):
1919
assert isinstance(path, pathlib.Path)
20-
parent = path.parent
2120
suffix = path.suffix
2221
suffixless_name = path.name[:-len(suffix)]
23-
assert '{}{}{}'.format(parent, suffixless_name, suffix) == path
22+
parent_with_separator = str(path)[:-len(path.name)]
23+
assert pathlib.Path('{}{}{}'.format(parent_with_separator,
24+
suffixless_name, suffix)) == path
2425
match = numbered_name_pattern.match(suffixless_name)
2526
if match:
2627
fixed_suffixless_name = '{} ({})'.format(
@@ -29,9 +30,8 @@ def _get_next_name(path):
2930
)
3031
else:
3132
fixed_suffixless_name = '{} (1)'.format(suffixless_name,)
32-
fix
3333
return pathlib.Path(
34-
'{}{}{}'.format(parent, suffixless_name, suffix)
34+
'{}{}{}'.format(parent_with_separator, fixed_suffixless_name, suffix)
3535
)
3636

3737

0 commit comments

Comments
 (0)