Globals/__init__.py

changeset 6474
72c063cc730b
parent 6366
6c1cd7e2902a
child 6530
25b9dcfd6fcc
equal deleted inserted replaced
6473:46d9adf29135 6474:72c063cc730b
14 from __future__ import unicode_literals 14 from __future__ import unicode_literals
15 15
16 import sys 16 import sys
17 import os 17 import os
18 import re 18 import re
19 import shutil
19 20
20 from PyQt5.QtCore import QDir, QLibraryInfo, QByteArray, QCoreApplication, \ 21 from PyQt5.QtCore import QDir, QLibraryInfo, QByteArray, QCoreApplication, \
21 QT_VERSION_STR, QT_VERSION 22 QT_VERSION_STR, QT_VERSION
22 23
23 # names of the various settings objects 24 # names of the various settings objects
172 # migrate the old config directory (< v18.06) 173 # migrate the old config directory (< v18.06)
173 cdnOld = "_eric6" 174 cdnOld = "_eric6"
174 hpOld = os.path.join(os.path.expanduser("~"), cdnOld) 175 hpOld = os.path.join(os.path.expanduser("~"), cdnOld)
175 if os.path.exists(hpOld): 176 if os.path.exists(hpOld):
176 hpNew = os.path.join(os.path.expanduser("~"), cdn) 177 hpNew = os.path.join(os.path.expanduser("~"), cdn)
177 os.rename(hpOld, hpNew) 178 if os.path.exists(hpNew):
179 # simply delete the old config directory
180 shutil.rmtree(hpOld, True)
181 else:
182 os.rename(hpOld, hpNew)
178 183
179 hp = os.path.join(os.path.expanduser("~"), cdn) 184 hp = os.path.join(os.path.expanduser("~"), cdn)
180 if not os.path.exists(hp): 185 if not os.path.exists(hp):
181 os.mkdir(hp) 186 os.mkdir(hp)
182 return hp 187 return hp

eric ide

mercurial