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