diff --git a/oml/item/icons.py b/oml/item/icons.py index 43c78d4..7d96d39 100644 --- a/oml/item/icons.py +++ b/oml/item/icons.py @@ -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):