src/eric7/Plugins/VcsPlugins/vcsGit/GitUtilities.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitUtilities.py	Thu Jul 07 11:23:56 2022 +0200
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2014 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing some common utility functions for the Git package.
+"""
+
+import os
+
+from PyQt6.QtCore import QProcessEnvironment
+
+import Utilities
+
+
+def getConfigPath():
+    """
+    Public function to get the filename of the config file.
+    
+    @return filename of the config file (string)
+    """
+    if Utilities.isWindowsPlatform():
+        userprofile = os.environ["USERPROFILE"]
+        return os.path.join(userprofile, ".gitconfig")
+    else:
+        homedir = Utilities.getHomeDir()
+        return os.path.join(homedir, ".gitconfig")
+
+
+def prepareProcess(proc, language=""):
+    """
+    Public function to prepare the given process.
+    
+    @param proc reference to the process to be prepared (QProcess)
+    @param language language to be set (string)
+    """
+    env = QProcessEnvironment.systemEnvironment()
+    
+    # set the language for the process
+    if language:
+        env.insert("LANGUAGE", language)
+    
+    proc.setProcessEnvironment(env)

eric ide

mercurial