use shutil.move instead of os.rename to move files. Fixes #6770
This commit is contained in:
parent
23d3d79f83
commit
6867d3cc98
|
@ -24,6 +24,7 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
|
@ -248,13 +249,11 @@ def check_and_possibly_move_config():
|
||||||
if not os.path.exists(src):
|
if not os.path.exists(src):
|
||||||
continue
|
continue
|
||||||
print 'moving %s to %s' % (src, dst)
|
print 'moving %s to %s' % (src, dst)
|
||||||
os.renames(src, dst)
|
shutil.move(src, dst)
|
||||||
gajim.logger.init_vars()
|
gajim.logger.init_vars()
|
||||||
gajim.logger.attach_cache_database()
|
gajim.logger.attach_cache_database()
|
||||||
|
|
||||||
def check_and_possibly_create_paths():
|
def check_and_possibly_create_paths():
|
||||||
check_and_possibly_move_config()
|
|
||||||
|
|
||||||
LOG_DB_PATH = logger.LOG_DB_PATH
|
LOG_DB_PATH = logger.LOG_DB_PATH
|
||||||
LOG_DB_FOLDER, LOG_DB_FILE = os.path.split(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')
|
print _('Gajim will now exit')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if not os.path.exists(LOG_DB_PATH):
|
if not os.path.exists(PLUGINS_CONFIG_PATH):
|
||||||
create_log_db()
|
create_path(PLUGINS_CONFIG_PATH)
|
||||||
gajim.logger.init_vars()
|
elif os.path.isfile(PLUGINS_CONFIG_PATH):
|
||||||
elif os.path.isdir(LOG_DB_PATH):
|
print _('%s is a file but it should be a directory') % PLUGINS_CONFIG_PATH
|
||||||
print _('%s is a directory but should be a file') % LOG_DB_PATH
|
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -327,6 +325,16 @@ def check_and_possibly_create_paths():
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
sys.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):
|
if not os.path.exists(CACHE_DB_PATH):
|
||||||
create_cache_db()
|
create_cache_db()
|
||||||
gajim.logger.attach_cache_database()
|
gajim.logger.attach_cache_database()
|
||||||
|
@ -335,13 +343,6 @@ def check_and_possibly_create_paths():
|
||||||
print _('Gajim will now exit')
|
print _('Gajim will now exit')
|
||||||
sys.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):
|
def create_path(directory):
|
||||||
head, tail = os.path.split(directory)
|
head, tail = os.path.split(directory)
|
||||||
if not os.path.exists(head):
|
if not os.path.exists(head):
|
||||||
|
|
Loading…
Reference in New Issue