use shutil.move instead of os.rename to move files. Fixes #6770

This commit is contained in:
Yann Leboulanger 2011-01-23 11:31:29 +01:00
parent 23d3d79f83
commit 6867d3cc98
1 changed files with 16 additions and 15 deletions

View File

@ -24,6 +24,7 @@
##
import os
import shutil
import sys
import stat
@ -248,13 +249,11 @@ def check_and_possibly_move_config():
if not os.path.exists(src):
continue
print 'moving %s to %s' % (src, dst)
os.renames(src, dst)
shutil.move(src, dst)
gajim.logger.init_vars()
gajim.logger.attach_cache_database()
def check_and_possibly_create_paths():
check_and_possibly_move_config()
LOG_DB_PATH = logger.LOG_DB_PATH
LOG_DB_FOLDER, LOG_DB_FILE = os.path.split(LOG_DB_PATH)
@ -312,11 +311,10 @@ def check_and_possibly_create_paths():
print _('Gajim will now exit')
sys.exit()
if not os.path.exists(LOG_DB_PATH):
create_log_db()
gajim.logger.init_vars()
elif os.path.isdir(LOG_DB_PATH):
print _('%s is a directory but should be a file') % LOG_DB_PATH
if not os.path.exists(PLUGINS_CONFIG_PATH):
create_path(PLUGINS_CONFIG_PATH)
elif os.path.isfile(PLUGINS_CONFIG_PATH):
print _('%s is a file but it should be a directory') % PLUGINS_CONFIG_PATH
print _('Gajim will now exit')
sys.exit()
@ -327,6 +325,16 @@ def check_and_possibly_create_paths():
print _('Gajim will now exit')
sys.exit()
check_and_possibly_move_config()
if not os.path.exists(LOG_DB_PATH):
create_log_db()
gajim.logger.init_vars()
elif os.path.isdir(LOG_DB_PATH):
print _('%s is a directory but should be a file') % LOG_DB_PATH
print _('Gajim will now exit')
sys.exit()
if not os.path.exists(CACHE_DB_PATH):
create_cache_db()
gajim.logger.attach_cache_database()
@ -335,13 +343,6 @@ def check_and_possibly_create_paths():
print _('Gajim will now exit')
sys.exit()
if not os.path.exists(PLUGINS_CONFIG_PATH):
create_path(PLUGINS_CONFIG_PATH)
elif os.path.isfile(PLUGINS_CONFIG_PATH):
print _('%s is a file but it should be a directory') % PLUGINS_CONFIG_PATH
print _('Gajim will now exit')
sys.exit()
def create_path(directory):
head, tail = os.path.split(directory)
if not os.path.exists(head):