Reset configuration files on start if old config files were found

This commit is contained in:
Arjen Hiemstra 2015-06-30 18:06:58 +02:00
parent 651b4fdfea
commit 8b9dbec188

View file

@ -41,7 +41,9 @@ from PyQt5.QtGui import QColor, QIcon
import platform
import sys
import os
import os.path
import configparser
import numpy
numpy.seterr(all="ignore")
@ -51,6 +53,23 @@ class CuraApplication(QtApplication):
if not hasattr(sys, "frozen"):
Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
# Reset the configuration files if they exist on the machine, only for 15.05.xx releases
try:
Resources.ApplicationIdentifier = "cura"
parser = configparser.ConfigParser()
parser.read(Resources.getStoragePath(Resources.PreferencesLocation, "cura.cfg"))
except FileNotFoundError:
pass
else:
if parser["general"]["version"] != "2":
Logger.log("i", "Found old settings files, removing them")
os.remove(Resources.getStoragePath(Resources.PreferencesLocation, "cura.cfg"))
path = Resources.getStorageLocation(Resources.SettingsLocation)
for file in os.listdir(path):
os.remove(os.path.join(path, file))
super().__init__(name = "cura", version = "15.06.00")
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))