File indexing completed on 2024-10-13 03:45:47

0001 /*
0002     SPDX-FileCopyrightText: 2017 Albert Astals Cid <aacid@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "filefactory.h"
0008 
0009 #include <QStandardPaths>
0010 
0011 bool FileFactory::folderExists(const QString &relativePath)
0012 {
0013 #if defined(Q_OS_ANDROID)
0014     Q_UNUSED(relativePath);
0015     return true;
0016 #else
0017     return !(QStandardPaths::locate(QStandardPaths::AppDataLocation, relativePath, QStandardPaths::LocateDirectory).isEmpty());
0018 #endif
0019 }
0020 
0021 QString FileFactory::locate(const QString &relativePath)
0022 {
0023 #if defined(Q_OS_ANDROID)
0024     return QLatin1String(":/") + relativePath;
0025 #else
0026     return QStandardPaths::locate(QStandardPaths::AppDataLocation, relativePath);
0027 #endif
0028 }
0029 
0030 QStringList FileFactory::locateAll(const QString &relativePath)
0031 {
0032 #if defined(Q_OS_ANDROID)
0033     return { QLatin1String(":/") + relativePath };
0034 #else
0035     return QStandardPaths::locateAll(QStandardPaths::AppDataLocation, relativePath, QStandardPaths::LocateDirectory);
0036 #endif
0037 }
0038