diff --git a/selfdrive/dragonpilot/__init__.py b/selfdrive/dragonpilot/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/selfdrive/dragonpilot/dragonconf/dragonconf.py b/selfdrive/dragonpilot/dragonconf/dragonconf.py new file mode 100644 index 000000000..995960690 --- /dev/null +++ b/selfdrive/dragonpilot/dragonconf/dragonconf.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python2.7 +import os +import json + +file = '/data/dragonpilot.json' + +class dragonconf(): + + def __init__(self): + self.conf = self.read() + + def read(self): + has_new_def = False + config = {} + if not os.path.isfile(file): + self.write(config) + + with open(file, 'r') as f: + config = json.load(f) + + # add config here + + if has_new_def: + self.write(config) + + return config + + def write(self, config): + with open(file, 'w') as f: + json.dump(config, f, indent=2, sort_keys=True) + os.chmod(file, 0644) + +if __name__ == "__main__": + dragonconf = dragonconf() \ No newline at end of file