~mhr3/unity8/fix-1297246

« back to all changes in this revision

Viewing changes to paths.h.in

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Ugo Riboni <ugo.riboni@canonical.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
// Qt
 
21
#include <QtCore/QCoreApplication>
 
22
#include <QtCore/QDir>
 
23
 
 
24
inline bool isRunningInstalled() {
 
25
    static bool installed = (QCoreApplication::applicationDirPath() ==
 
26
                             QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
 
27
    return installed;
 
28
}
 
29
 
 
30
inline QString translationDirectory() {
 
31
    if (isRunningInstalled()) {
 
32
        return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
 
33
    } else {
 
34
        return QString("@CMAKE_BINARY_DIR@/po/locale");
 
35
    }
 
36
}
 
37
 
 
38
inline QString shellAppDirectory() {
 
39
    if (isRunningInstalled()) {
 
40
        return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
 
41
    } else {
 
42
        return QString("@CMAKE_SOURCE_DIR@/");
 
43
    }
 
44
}
 
45
 
 
46
inline QString shellImportPath() {
 
47
    if (isRunningInstalled()) {
 
48
        return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/plugins");
 
49
    } else {
 
50
        return QString("@CMAKE_BINARY_DIR@/plugins/");
 
51
    }
 
52
}
 
53
 
 
54
inline QString fakePluginsImportPath() {
 
55
    if (isRunningInstalled()) {
 
56
        return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/plugins/mocks");
 
57
    } else {
 
58
        return QString("@CMAKE_BINARY_DIR@/tests/mocks");
 
59
    }
 
60
}
 
61
 
 
62
inline QString sourceDirectory() {
 
63
    return QString("@CMAKE_SOURCE_DIR@/");
 
64
}