1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# Copyright (C) 2012 Naing Ye Minn <naingyeminn@gmail.com>
4
# Permission is hereby granted, free of charge, to any person obtaining a copy
5
# of this software and associated documentation files (the "Software"), to deal
6
# in the Software without restriction, including without limitation the rights
7
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
# copies of the Software, and to permit persons to whom the Software is
9
# furnished to do so, subject to the following conditions:
11
# The above copyright notice and this permission notice shall be included in
12
# all copies or substantial portions of the Software.
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
# THIS IS MyFsCli CONFIGURATION FILE
24
# YOU CAN PUT THERE SOME GLOBAL VALUE
25
# Do not touch unless you know what you're doing.
29
'project_path_not_found',
34
# Where your project will look for your data (for instance, images and ui
35
# files). By default, this is ../data, relative your trunk layout
36
__my_fs_cli_data_directory__ = '../data/'
38
__version__ = 'VERSION'
43
from gettext import gettext as _
44
gettext.textdomain('my-fs-cli')
46
class project_path_not_found(Exception):
47
"""Raised when we can't find the project directory."""
50
def get_data_file(*path_segments):
51
"""Get the full path to a data file.
53
Returns the path to a file underneath the data directory (as defined by
54
`get_data_path`). Equivalent to os.path.join(get_data_path(),
57
return os.path.join(get_data_path(), *path_segments)
61
"""Retrieve my-fs-cli data path
63
This path is by default <my_fs_cli_lib_path>/../data/ in trunk
64
and /usr/share/my-fs-cli in an installed version but this path
65
is specified at installation time.
68
# Get pathname absolute or relative.
70
os.path.dirname(__file__), __my_fs_cli_data_directory__)
72
abs_data_path = os.path.abspath(path)
73
if not os.path.exists(abs_data_path):
74
raise project_path_not_found