Skip to content
Snippets Groups Projects
Commit 6867d3cc authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

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

parent 23d3d79f
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment