Salome HOME
Some Python refactoring and use argparse instead of optparse
[modules/kernel.git] / bin / salome_utils.py
index a27009a45e81d300c436e11fd996af1bca51291a..f20f672766a440fb95ccf0b68cf2766f32e65034 100644 (file)
@@ -208,24 +208,8 @@ def getHomeDir():
     """
     Get home directory.
     """
-    import os, sys
-    if sys.platform == "win32":
-        # for Windows the home directory is detected in the following way:
-        # 1. try USERPROFILE env variable
-        # 2. try combination of HOMEDRIVE and HOMEPATH env variables
-        # 3. try HOME env variable
-        # TODO: on Windows, also GetUserProfileDirectoryW() system function might be used
-        dir = os.getenv("USERPROFILE")
-        if not dir and os.getenv("HOMEDRIVE") and os.getenv("HOMEPATH"):
-            dir = os.path.join(os.getenv("HOMEDRIVE"), os.getenv("HOMEPATH"))
-        if not dir:
-            dir = os.getenv("HOME")
-        pass
-    else:
-        # for Linux: use HOME variable
-        dir = os.getenv("HOME")
-        pass
-    return dir
+    import os
+    return os.path.realpath(os.path.expanduser('~'))
 # ---
 
 def getTmpDir():