AusweisApp2/src/global/FileDestination.h

47 lines
842 B
C
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*
* \brief Little helper that will abstract pathes of underlying systems
*
2019-05-22 10:08:38 +02:00
* \copyright Copyright (c) 2014-2019 Governikus GmbH & Co. KG, Germany
2017-07-03 09:30:10 +02:00
*/
#pragma once
#include <QCoreApplication>
#include <QStringBuilder>
namespace governikus
{
class FileDestination
{
private:
FileDestination() = delete;
~FileDestination() = delete;
Q_DISABLE_COPY(FileDestination)
static QString getPath()
{
2019-01-03 15:06:22 +01:00
#if defined(Q_OS_ANDROID)
2017-07-03 09:30:10 +02:00
return QStringLiteral("assets:");
2019-01-03 15:06:22 +01:00
#elif defined(Q_OS_MACOS) && defined(QT_NO_DEBUG)
return QCoreApplication::applicationDirPath() + QStringLiteral("/../Resources");
2017-07-03 09:30:10 +02:00
#else
return QCoreApplication::applicationDirPath();
#endif
}
public:
static QString getPath(const QString& pFilename)
{
return getPath() % QLatin1Char('/') % pFilename;
}
};
2019-01-03 15:06:22 +01:00
} // namespace governikus