eric7/Globals/__init__.py

branch
eric7
changeset 8468
57ed532d4cde
parent 8467
bccf0a3fa67c
child 8501
7b5f10581c35
equal deleted inserted replaced
8467:bccf0a3fa67c 8468:57ed532d4cde
12 # 12 #
13 13
14 import sys 14 import sys
15 import os 15 import os
16 import re 16 import re
17 import shutil
18 import contextlib 17 import contextlib
19 18
20 from PyQt6.QtCore import ( 19 from PyQt6.QtCore import (
21 QDir, QByteArray, QCoreApplication, QT_VERSION, QProcess, qVersion 20 QDir, QByteArray, QCoreApplication, QT_VERSION, QProcess, qVersion
22 ) 21 )
202 """ 201 """
203 if configDir is not None and os.path.exists(configDir): 202 if configDir is not None and os.path.exists(configDir):
204 hp = configDir 203 hp = configDir
205 else: 204 else:
206 cdn = ".eric7" 205 cdn = ".eric7"
207 if isWindowsPlatform():
208 # migrate the old config directory (< v18.06)
209 cdnOld = "_eric7"
210 hpOld = os.path.join(os.path.expanduser("~"), cdnOld)
211 if os.path.exists(hpOld):
212 hpNew = os.path.join(os.path.expanduser("~"), cdn)
213 if os.path.exists(hpNew):
214 # simply delete the old config directory
215 shutil.rmtree(hpOld, True)
216 else:
217 os.rename(hpOld, hpNew)
218
219 hp = os.path.join(os.path.expanduser("~"), cdn) 206 hp = os.path.join(os.path.expanduser("~"), cdn)
220 if not os.path.exists(hp): 207 if not os.path.exists(hp):
221 os.mkdir(hp) 208 os.mkdir(hp)
222 return hp 209 return hp
223 210

eric ide

mercurial