~jonobacon/acire/trunk

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