mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
Reset configuration files on start if old config files were found
This commit is contained in:
parent
651b4fdfea
commit
8b9dbec188
1 changed files with 19 additions and 0 deletions
|
@ -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")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue