eric6_webbrowser.py

changeset 4343
afe0da217745
parent 4289
6c1ab651c9ce
child 4631
5c1a96925da4
--- a/eric6_webbrowser.py	Tue Jul 28 19:19:23 2015 +0200
+++ b/eric6_webbrowser.py	Sat Aug 01 13:41:33 2015 +0200
@@ -17,7 +17,7 @@
 import Toolbox.PyQt4ImportHook  # __IGNORE_WARNING__
 
 try:  # Only for Py2
-    import Utilities.compatibility_fixes     # __IGNORE_WARNING__
+    import Globals.compatibility_fixes     # __IGNORE_WARNING__
 except (ImportError):
     pass
 
@@ -30,13 +30,20 @@
 import sys
 import os
 
-for arg in sys.argv:
+for arg in sys.argv[:]:
     if arg.startswith("--config="):
         import Globals
         configDir = arg.replace("--config=", "")
         Globals.setConfigDir(configDir)
         sys.argv.remove(arg)
-        break
+    elif arg.startswith("--settings="):
+        from PyQt5.QtCore import QSettings
+        settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
+        if not os.path.isdir(settingsDir):
+            os.makedirs(settingsDir)
+        QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
+                          settingsDir)
+        sys.argv.remove(arg)
 
 # make ThirdParty package available as a packages repository
 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
@@ -81,7 +88,9 @@
     options = [
         ("--config=configDir",
          "use the given directory as the one containing the config files"),
-        ("--search=word", "search for the given word")
+        ("--search=word", "search for the given word"),
+        ("--settings=settingsDir",
+         "use the given directory to store the settings files"),
     ]
     appinfo = AppInfo.makeAppInfo(sys.argv,
                                   "eric6 Web Browser",

eric ide

mercurial