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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2009 Jono Bacon <jono@ubuntu.com>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundation.
#
#This program is distributed in the hope that it will be useful, but
#WITHOUT ANY WARRANTY; without even the implied warranties of
#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
#PURPOSE. See the GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License along
#with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
# THIS IS Acire CONFIGURATION FILE
# YOU CAN PUT THERE SOME GLOBAL VALUE
# Do not touch until you know what you're doing.
# you're warned :)
# where your project will head for your data (for instance, images and ui files)
# by default, this is ../data, relative your trunk layout
__acire_data_directory__ = '../data/'
import os
class project_path_not_found(Exception):
pass
def getdatapath():
"""Retrieve acire data path
This path is by default <acire_lib_path>/../data/ in trunk
and /usr/share/acire in an installed version but this path
is specified at installation time.
"""
# get pathname absolute or relative
if __acire_data_directory__.startswith('/'):
pathname = __acire_data_directory__
else:
pathname = os.path.dirname(__file__) + '/' + __acire_data_directory__
abs_data_path = os.path.abspath(pathname)
if os.path.exists(abs_data_path):
return abs_data_path
else:
raise project_path_not_found
|