import YuzuUpdater.Contants as const
import json
import os

class ConfigHandler:
    def __init__(self, rootPath) -> None:
        self.rootPath = rootPath
    
    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode="r+"):
        return open(const.CONFIG_FILENAME, mode)

    def writeOnConfigFile(self, json):
        file = self.openConfigFile("w+")
        file.write(json)
        file.close()

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic

5d67133c0292f7c6728aa9648e7817c1d3b7866c
<mask token>


class ConfigHandler:
    <mask token>

    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode='r+'):
        return open(const.CONFIG_FILENAME, mode)
    <mask token>

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic

<mask token>


class ConfigHandler:

    def __init__(self, rootPath) ->None:
        self.rootPath = rootPath

    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode='r+'):
        return open(const.CONFIG_FILENAME, mode)
    <mask token>

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic

<mask token>


class ConfigHandler:

    def __init__(self, rootPath) ->None:
        self.rootPath = rootPath

    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode='r+'):
        return open(const.CONFIG_FILENAME, mode)

    def writeOnConfigFile(self, json):
        file = self.openConfigFile('w+')
        file.write(json)
        file.close()

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic

import YuzuUpdater.Contants as const
import json
import os


class ConfigHandler:

    def __init__(self, rootPath) ->None:
        self.rootPath = rootPath

    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode='r+'):
        return open(const.CONFIG_FILENAME, mode)

    def writeOnConfigFile(self, json):
        file = self.openConfigFile('w+')
        file.write(json)
        file.close()

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic

import YuzuUpdater.Contants as const
import json
import os

class ConfigHandler:
    def __init__(self, rootPath) -> None:
        self.rootPath = rootPath
    
    def createConfigFileJson(self):
        if not os.path.exists(f'{self.rootPath}/{const.CONFIG_FILENAME}'):
            self.writeOnConfigFile('{\n\t"version": "default"\n}')
            return self.openConfigFile()
        return self.openConfigFile()

    def openConfigFile(self, mode="r+"):
        return open(const.CONFIG_FILENAME, mode)

    def writeOnConfigFile(self, json):
        file = self.openConfigFile("w+")
        file.write(json)
        file.close()

    def readJsonConfigFile(self):
        file = self.createConfigFileJson()
        jsonDic = json.load(file)
        file.close()
        return jsonDic
