1
2 """Hardcoded values"""
3
4 from os import path,makedirs,environ
5 from PyFoam.ThirdParty.six import PY3
6
7 _pyFoamDirName="pyFoam"
8
9 _pyFoamConfigName="pyfoamrc"
10
11 pyFoamSiteVar="PYFOAM_SITE_DIR"
12
16
20
22 """@return: The name of the global configuration directory where .cfg-files can be placed"""
23 return globalConfigFile()+".d"
24
31
38
40 """@return: The name of the site configuration directory where .cfg-files can be placed"""
41 if pyFoamSiteVar in environ:
42 return siteConfigFile()+".d"
43 else:
44 return None
45
49
53
55 """@return: The name of the user configuration directory where .cfg-files can be placed"""
56 return userConfigFile()+".d"
57
64
66 """Path to the log directory that this user may write to.
67 /var/log/pyFoam for root, ~/.pyFoam/log for all others
68 @return: path to the log directory."""
69 if userName()=="root":
70 return path.join("/var/log","pyFoam")
71 else:
72 return path.join(userDirectory(),"log")
73
75 """Makes sure that the directory exists
76 @param name: the directory"""
77 if path.exists(name):
78 return
79 else:
80 if PY3:
81 perm=eval("0o755")
82 else:
83 perm=eval("0755")
84
85 makedirs(name,mode=perm)
86
87
88