Fix wrong Path
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
import os.path
 | 
			
		||||
import os.path, os
 | 
			
		||||
import json, codecs
 | 
			
		||||
 | 
			
		||||
##---------------------------------------------------------------------------------------##
 | 
			
		||||
@@ -34,11 +34,12 @@ class Config(object):
 | 
			
		||||
    ##-----------------------------------------------------------------------------------##
 | 
			
		||||
    def read(self, type):
 | 
			
		||||
    ##-----------------------------------------------------------------------------------##
 | 
			
		||||
        path = os.getcwd()
 | 
			
		||||
        data = None
 | 
			
		||||
        if(type == "settings"):
 | 
			
		||||
            print("Reading 'settings.json'")
 | 
			
		||||
            if(os.path.isfile("config/settings.json")):
 | 
			
		||||
                with open('config/settings.json', encoding='utf-8') as data_file:
 | 
			
		||||
            if(os.path.isfile(path + "config/settings.json")):
 | 
			
		||||
                with open(path + 'config/settings.json', encoding='utf-8') as data_file:
 | 
			
		||||
                    try:
 | 
			
		||||
                        data = json.loads(data_file.read())
 | 
			
		||||
                    except:
 | 
			
		||||
@@ -51,8 +52,8 @@ class Config(object):
 | 
			
		||||
                self.writeConfig("settings", data)
 | 
			
		||||
        else:
 | 
			
		||||
            print("Reading 'devices.json'")
 | 
			
		||||
            if(os.path.isfile("config/devices.json")):
 | 
			
		||||
                with open('config/devices.json', encoding='utf-8') as data_file:
 | 
			
		||||
            if(os.path.isfile(path + "config/devices.json")):
 | 
			
		||||
                with open(path + 'config/devices.json', encoding='utf-8') as data_file:
 | 
			
		||||
                    try:
 | 
			
		||||
                        data = json.loads(data_file.read())
 | 
			
		||||
                    except:
 | 
			
		||||
@@ -68,13 +69,14 @@ class Config(object):
 | 
			
		||||
    ##-----------------------------------------------------------------------------------##
 | 
			
		||||
    def writeConfig(self, type, data):
 | 
			
		||||
    ##-----------------------------------------------------------------------------------##
 | 
			
		||||
        path = os.getcwd()
 | 
			
		||||
        if(type == "settings"):
 | 
			
		||||
            print("Writing 'settings.json'")
 | 
			
		||||
            with open('config/settings.json', 'w') as outfile:
 | 
			
		||||
            with open(path + 'config/settings.json', 'w') as outfile:
 | 
			
		||||
                json.dump(data, outfile, indent=4)
 | 
			
		||||
            print("Settings written")
 | 
			
		||||
        else:
 | 
			
		||||
            print("Writing 'devices.json'")
 | 
			
		||||
            with open('config/devices.json', 'w') as outfile:
 | 
			
		||||
            with open(path + 'config/devices.json', 'w') as outfile:
 | 
			
		||||
                json.dump(data, outfile, indent=4)
 | 
			
		||||
            print("Devices written")
 | 
			
		||||
		Reference in New Issue
	
	Block a user