forked from aarronc/hutton-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.py
35 lines (22 loc) · 822 Bytes
/
data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Looks after our data.
"""
import os, sys
from config import config # EDMC
import xmit
# For compatibility with pre-5.0.0
if not hasattr(config, 'get_str'):
config.get_str = config.get
HH_PLUGIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
def get_data_path(*args):
"Get the path to our data directory, or to a subdirectory or filename in it."
data_path = os.path.join(HH_PLUGIN_DIRECTORY, 'data')
if os.path.exists(data_path):
assert os.path.isdir(data_path)
else:
os.mkdir(data_path, 755)
return os.path.join(data_path, *args)
def get_journal_path(*args):
"Get the path to the journal directory, or to a subdirectory or filename in it."
logdir = config.get_str('journaldir') or config.default_journal_dir
return os.path.join(logdir, *args)