File indexing completed on 2024-04-21 03:51:39

0001 /*
0002     This file is part of the KDE Baloo Project
0003     SPDX-FileCopyrightText: 2015 Ashish Bansal <bansal.ashish096@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #include "database.h"
0009 #include "global.h"
0010 
0011 #include <QStandardPaths>
0012 using namespace Baloo;
0013 
0014 Q_GLOBAL_STATIC_WITH_ARGS(Database, s_db, (fileIndexDbPath()))
0015 
0016 QString Baloo::fileIndexDbPath()
0017 {
0018     QString envBalooPath = QString::fromLocal8Bit(qgetenv("BALOO_DB_PATH"));
0019     if (!envBalooPath.isEmpty()) {
0020         return envBalooPath;
0021     }
0022 
0023     static QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/baloo");
0024     return path;
0025 }
0026 
0027 Database* Baloo::globalDatabaseInstance()
0028 {
0029     return s_db;
0030 }