eric7/Plugins/VcsPlugins/vcsGit/GitUtilities.py

branch
eric7
changeset 8312
800c432b34c8
parent 7923
91e843545d9a
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing some common utility functions for the Git package.
8 """
9
10 import os
11
12 from PyQt5.QtCore import QProcessEnvironment
13
14 import Utilities
15
16
17 def getConfigPath():
18 """
19 Public function to get the filename of the config file.
20
21 @return filename of the config file (string)
22 """
23 if Utilities.isWindowsPlatform():
24 userprofile = os.environ["USERPROFILE"]
25 return os.path.join(userprofile, ".gitconfig")
26 else:
27 homedir = Utilities.getHomeDir()
28 return os.path.join(homedir, ".gitconfig")
29
30
31 def prepareProcess(proc, language=""):
32 """
33 Public function to prepare the given process.
34
35 @param proc reference to the process to be prepared (QProcess)
36 @param language language to be set (string)
37 """
38 env = QProcessEnvironment.systemEnvironment()
39
40 # set the language for the process
41 if language:
42 env.insert("LANGUAGE", language)
43
44 proc.setProcessEnvironment(env)

eric ide

mercurial