AusweisApp2/src/global/FileDestination.h

50 lines
830 B
C
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*
* \brief Little helper that will abstract pathes of underlying systems
*
2017-12-20 14:54:05 +01:00
* \copyright Copyright (c) 2014-2017 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()
{
#ifdef Q_OS_ANDROID
return QStringLiteral("assets:");
#else
return QCoreApplication::applicationDirPath();
#endif
}
public:
static QString getPath(const QString& pFilename)
{
return getPath() % QLatin1Char('/') % pFilename;
}
static QString getPath(const char* pFilename)
{
return getPath() % QLatin1Char('/') % QString::fromUtf8(pFilename);
}
};
} /* namespace governikus */