1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# This file is in the public domain
6
# THIS IS XkcdBrowser CONFIGURATION FILE
7
# YOU CAN PUT THERE SOME GLOBAL VALUE
8
# Do not touch unless you know what you're doing.
12
'project_path_not_found',
17
# Where your project will look for your data (for instance, images and ui
18
# files). By default, this is ../data, relative your trunk layout
19
__xkcd_browser_data_directory__ = '../data/'
21
__version__ = 'VERSION'
26
from gettext import gettext as _
27
gettext.textdomain('xkcd-browser')
29
class project_path_not_found(Exception):
30
"""Raised when we can't find the project directory."""
33
def get_data_file(*path_segments):
34
"""Get the full path to a data file.
36
Returns the path to a file underneath the data directory (as defined by
37
`get_data_path`). Equivalent to os.path.join(get_data_path(),
40
return os.path.join(get_data_path(), *path_segments)
44
"""Retrieve xkcd-browser data path
46
This path is by default <xkcd_browser_lib_path>/../data/ in trunk
47
and /usr/share/xkcd-browser in an installed version but this path
48
is specified at installation time.
51
# Get pathname absolute or relative.
53
os.path.dirname(__file__), __xkcd_browser_data_directory__)
55
abs_data_path = os.path.abspath(path)
56
if not os.path.exists(abs_data_path):
57
raise project_path_not_found