1 | /* |
2 | This file is part of the KDE Baloo Project |
3 | SPDX-FileCopyrightText: 2015 Ashish Bansal <bansal.ashish096@gmail.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
6 | */ |
7 | |
8 | #include "database.h" |
9 | #include "global.h" |
10 | |
11 | #include <QStandardPaths> |
12 | using namespace Baloo; |
13 | |
14 | Q_GLOBAL_STATIC_WITH_ARGS(Database, s_db, (fileIndexDbPath())) |
15 | |
16 | QString Baloo::fileIndexDbPath() |
17 | { |
18 | QString envBalooPath = QString::fromLocal8Bit(ba: qgetenv(varName: "BALOO_DB_PATH" )); |
19 | if (!envBalooPath.isEmpty()) { |
20 | return envBalooPath; |
21 | } |
22 | |
23 | static QString path = QStandardPaths::writableLocation(type: QStandardPaths::GenericDataLocation) + QLatin1String("/baloo" ); |
24 | return path; |
25 | } |
26 | |
27 | Database* Baloo::globalDatabaseInstance() |
28 | { |
29 | return s_db; |
30 | } |
31 | |