Total Complexity | 9 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 85.71% |
1 | 1 | from plugin.core.constants import PLUGIN_IDENTIFIER |
|
6 | 1 | class PathEnvironment(object): |
|
7 | # TODO confirm validity of this on *nix and OS X |
||
|
|||
8 | |||
9 | 1 | def __init__(self, core): |
|
10 | 1 | self._core = core |
|
11 | |||
12 | 1 | self._plugin_support = None |
|
13 | |||
14 | 1 | @property |
|
15 | def code(self): |
||
16 | 1 | return self._core.code_path |
|
17 | |||
18 | 1 | @property |
|
19 | def libraries(self): |
||
20 | 1 | return os.path.abspath(os.path.join(self.code, '..', 'Libraries')) |
|
21 | |||
22 | 1 | @property |
|
23 | def plugin_caches(self): |
||
24 | 1 | return os.path.join(self.plugin_support, 'Caches', PLUGIN_IDENTIFIER) |
|
25 | |||
26 | 1 | @property |
|
27 | def plugin_data(self): |
||
28 | return os.path.join(self.plugin_support, 'Data', PLUGIN_IDENTIFIER) |
||
29 | |||
30 | 1 | @property |
|
31 | def plugin_database(self): |
||
32 | 1 | return os.path.join(self.plugin_support, 'Databases', '%s.db' % PLUGIN_IDENTIFIER) |
|
33 | |||
34 | 1 | @property |
|
35 | def plugin_support(self): |
||
36 | 1 | if self._plugin_support is not None: |
|
37 | 1 | return self._plugin_support |
|
38 | |||
39 | base_path = self.code[:self.code.index(os.path.sep + 'Plug-ins')] |
||
40 | |||
41 | return os.path.join(base_path, 'Plug-in Support') |
||
42 | |||
43 | 1 | @plugin_support.setter |
|
44 | def plugin_support(self, path): |
||
45 | 1 | self._plugin_support = path |
|
46 | |||
80 |