1
2 """Hardcoded values"""
3
4 from os import path,makedirs,environ
5
6 _pyFoamDirName="pyFoam"
7
8 _pyFoamConfigName="pyfoamrc"
9
11 """@return: the global directory"""
12 return path.join("/etc",_pyFoamDirName)
13
17
19 """@return: the user directory"""
20 return path.expanduser(path.join("~","."+_pyFoamDirName))
21
25
27 """@return: name of the current user"""
28 user=""
29 if environ.has_key("USER"):
30 user=environ["USER"]
31 return user
32
34 """Path to the log directory that this user may write to.
35 /var/log/pyFoam for root, ~/.pyFoam/log for all others
36 @return: path to the log directory."""
37 if userName()=="root":
38 return path.join("/var/log","pyFoam")
39 else:
40 return path.join(userDirectory(),"log")
41
43 """Makes sure that the directory exists
44 @param name: the directory"""
45 if path.exists(name):
46 return
47 else:
48 makedirs(name,mode=0755)
49