1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """
18 Class is used to select first appropriate path.
19 """
20
21 import os
22 import os.path
23
24 from libxyz import const
25
27 """
28 Class is used to select first appropriate path.
29 Common rule is to load system file first and then user's one
30 """
31
38
39
40
42 """
43 Return tuple of (system_conf_path, user_conf_path)
44 """
45
46 return self._get(self.conf_dir, conf)
47
48
49
51 """
52 Return tuple of (system_skin_path, user_skin_path)
53 """
54
55 return self._get(self.skins_dir, skin)
56
57
58
59 - def _get(self, subdir, obj):
60 _userpath = os.path.join(self.user_dir, subdir, obj)
61 _systempath = os.path.join(self.system_dir, subdir, obj)
62
63 return (_systempath, _userpath)
64
65
66
68 """
69 Return first existing file from supplied files or False in none exist
70 """
71
72 for _file in files:
73 if os.access(_file, os.R_OK):
74 return _file
75
76 return None
77
78
79
81 _userpath = os.path.join(self.user_dir, self.plugins_dir)
82 _systempath = os.path.join(self.system_dir, self.plugins_dir)
83
84 return [_userpath, _systempath]
85
86
87
89 _userpath = os.path.join(self.user_dir, self.skins_dir)
90 _systempath = os.path.join(self.system_dir, self.skins_dir)
91
92 return [_userpath, _systempath]
93