15 from __future__ import unicode_literals |
15 from __future__ import unicode_literals |
16 |
16 |
17 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ |
17 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ |
18 |
18 |
19 try: # Only for Py2 |
19 try: # Only for Py2 |
20 import Utilities.compatibility_fixes # __IGNORE_WARNING__ |
20 import Globals.compatibility_fixes # __IGNORE_WARNING__ |
21 except (ImportError): |
21 except (ImportError): |
22 pass |
22 pass |
23 |
23 |
24 import sys |
24 import sys |
25 import os |
25 import os |
26 |
26 |
27 for arg in sys.argv: |
27 for arg in sys.argv[:]: |
28 if arg.startswith("--config="): |
28 if arg.startswith("--config="): |
29 import Globals |
29 import Globals |
30 configDir = arg.replace("--config=", "") |
30 configDir = arg.replace("--config=", "") |
31 Globals.setConfigDir(configDir) |
31 Globals.setConfigDir(configDir) |
32 sys.argv.remove(arg) |
32 sys.argv.remove(arg) |
33 break |
33 elif arg.startswith("--settings="): |
|
34 from PyQt5.QtCore import QSettings |
|
35 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) |
|
36 if not os.path.isdir(settingsDir): |
|
37 os.makedirs(settingsDir) |
|
38 QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, |
|
39 settingsDir) |
|
40 sys.argv.remove(arg) |
34 |
41 |
35 # make ThirdParty package available as a packages repository |
42 # make ThirdParty package available as a packages repository |
36 sys.path.insert(2, os.path.join(os.path.dirname(__file__), |
43 sys.path.insert(2, os.path.join(os.path.dirname(__file__), |
37 "ThirdParty", "Pygments")) |
44 "ThirdParty", "Pygments")) |
38 |
45 |
60 Main entry point into the application. |
67 Main entry point into the application. |
61 """ |
68 """ |
62 options = [ |
69 options = [ |
63 ("--config=configDir", |
70 ("--config=configDir", |
64 "use the given directory as the one containing the config files"), |
71 "use the given directory as the one containing the config files"), |
|
72 ("--settings=settingsDir", |
|
73 "use the given directory to store the settings files"), |
65 ("", "name of file to edit") |
74 ("", "name of file to edit") |
66 ] |
75 ] |
67 appinfo = AppInfo.makeAppInfo(sys.argv, |
76 appinfo = AppInfo.makeAppInfo(sys.argv, |
68 "Eric6 Editor", |
77 "Eric6 Editor", |
69 "", |
78 "", |