Duplicate code for creating defaults.json

Issue #168 resolved
Juan Pablo Caram repo owner created an issue

At FlatCAMApp.__init__():

        try:
            f = open(self.data_path + '/defaults.json')
            f.close()
        except IOError:
            App.log.debug('Creating empty defaults.json')
            f = open(self.data_path + '/defaults.json', 'w')
            json.dump({}, f)
            f.close()

        try:
            f = open(self.data_path + '/recent.json')
            f.close()
        except IOError:
            App.log.debug('Creating empty recent.json')
            f = open(self.data_path + '/recent.json', 'w')
            json.dump([], f)
            f.close()

The second part should never happen.

Comments (1)

  1. Log in to comment