FIX: Fix path for JSON registry

This commit is contained in:
Dominique Barton 2019-02-23 18:46:09 +01:00
parent 943b552771
commit 50a50629ee

View file

@ -24,7 +24,7 @@ class RegistryDict(dict):
which reads and writes the registry from/to disk.
'''
registry_path = '/etc/mopidy/pummeluff_cards.json'
registry_path = '/var/lib/mopidy/pummeluff/cards.json'
def __init__(self):
super(RegistryDict, self).__init__(self)
@ -74,7 +74,13 @@ class RegistryDict(dict):
'''
LOGGER.debug('Writing registry to %s', self.registry_path)
with open(self.registry_path, 'w') as f:
config = self.registry_path
directory = os.path.dirname(config)
if not os.path.exists(directory):
os.makedirs(directory)
with open(config, 'w') as f:
json.dump(self, f, indent=4)