don't remove a file before renaming under windows because os.remove('test') will remove 'TEST' under window. Fixes #5279
This commit is contained in:
parent
cb1fccca7c
commit
245c3f12d4
|
@ -170,6 +170,11 @@ def prep(user, server, resource):
|
||||||
else:
|
else:
|
||||||
return server
|
return server
|
||||||
|
|
||||||
|
def windowsify(s):
|
||||||
|
if os.name == 'nt':
|
||||||
|
return s.capitalize()
|
||||||
|
return s
|
||||||
|
|
||||||
def temp_failure_retry(func, *args, **kwargs):
|
def temp_failure_retry(func, *args, **kwargs):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1271,8 +1271,10 @@ class GroupchatControl(ChatControlBase, GroupChatCommands):
|
||||||
os.path.join(path, puny_new_nick + ext)
|
os.path.join(path, puny_new_nick + ext)
|
||||||
for old_file in files:
|
for old_file in files:
|
||||||
if os.path.exists(old_file) and old_file != files[old_file]:
|
if os.path.exists(old_file) and old_file != files[old_file]:
|
||||||
if os.path.exists(files[old_file]):
|
if os.path.exists(files[old_file]) and helpers.windowsify(
|
||||||
# Windows require this
|
old_file) != helpers.windowsify(files[old_file]):
|
||||||
|
# Windows require this, but os.remove('test') will also
|
||||||
|
# remove 'TEST'
|
||||||
os.remove(files[old_file])
|
os.remove(files[old_file])
|
||||||
os.rename(old_file, files[old_file])
|
os.rename(old_file, files[old_file])
|
||||||
self.print_conversation(s, 'info', tim)
|
self.print_conversation(s, 'info', tim)
|
||||||
|
|
Loading…
Reference in New Issue