OSDN Git Service

cf1eee5bc097caef6d4e2659e4a56eb14a65fcd0
[rec10/rec10-git.git] / dist / trunk / rec10 / configreader.py
1 #!/usr/bin/python\r
2 # coding: UTF-8\r
3 # Rec10 TS Recording Tools\r
4 # Copyright (C) 2009-2011 Yukikaze\r
5 import ConfigParser\r
6 import os\r
7 import os.path\r
8 mypath = str(os.path.dirname(os.path.abspath(__file__)))\r
9 confp = ConfigParser.SafeConfigParser()\r
10 Conf = 'rec10.conf'\r
11 confpath=""\r
12 if os.path.exists(os.path.join(mypath,Conf)):\r
13     confpath=os.path.join(mypath,Conf)\r
14 elif os.path.exists(os.path.join("/etc","rec10.conf")):\r
15     confpath=os.path.join("/etc","rec10.conf")\r
16 elif os.path.exists(os.path.join("/etc/rec10","rec10.conf")):\r
17     confpath=os.path.join("/etc/rec10","rec10.conf")\r
18 confp.read(confpath)\r
19 def getConfPath(string):\r
20     global confp\r
21     return confp.get('path', string)\r
22 def getConfDB(string):\r
23     global confp\r
24     return confp.get('db', string)\r
25 def getConfEnv(string):\r
26     global confp\r
27     return confp.get('env', string)\r
28 def getConfLog(string):\r
29     global confp\r
30     return confp.get('log', string)\r