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 name of the global configuration directory where .cfg-files can be placed"""
20 return globalConfigFile()+".d"
21
23 """@return: the user directory"""
24 return path.expanduser(path.join("~","."+_pyFoamDirName))
25
29
31 """@return: The name of the user configuration directory where .cfg-files can be placed"""
32 return userConfigFile()+".d"
33
35 """@return: name of the current user"""
36 user=""
37 if environ.has_key("USER"):
38 user=environ["USER"]
39 return user
40
42 """Path to the log directory that this user may write to.
43 /var/log/pyFoam for root, ~/.pyFoam/log for all others
44 @return: path to the log directory."""
45 if userName()=="root":
46 return path.join("/var/log","pyFoam")
47 else:
48 return path.join(userDirectory(),"log")
49
51 """Makes sure that the directory exists
52 @param name: the directory"""
53 if path.exists(name):
54 return
55 else:
56 makedirs(name,mode=0755)
57