only create folder if target parent exists

This commit is contained in:
j 2019-01-23 00:32:11 +05:30
parent 31e91d16bf
commit 7f05b08238
1 changed files with 7 additions and 5 deletions

View File

@ -129,12 +129,14 @@ def get_icons_db_path():
import settings
import shutil
metadata = os.path.join(os.path.expanduser(settings.preferences['libraryPath']), 'Metadata')
ox.makedirs(metadata)
library = os.path.expanduser(settings.preferences['libraryPath'])
metadata = os.path.join(library, 'Metadata')
icons_db_path = os.path.join(metadata, 'icons.db')
old_icons_db_path = os.path.join(settings.data_path, 'icons.db')
if not os.path.exists(icons_db_path) and os.path.exists(old_icons_db_path):
shutil.move(old_icons_db_path, icons_db_path)
if os.path.exists(os.path.dirname(library)):
ox.makedirs(metadata)
old_icons_db_path = os.path.join(settings.data_path, 'icons.db')
if not os.path.exists(icons_db_path) and os.path.exists(old_icons_db_path):
shutil.move(old_icons_db_path, icons_db_path)
return icons_db_path
def get_icon_sync(id, type_, size):