AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
FileDestination.h
gehe zur Dokumentation dieser Datei
1 /*
2  * \brief Little helper that will abstract pathes of underlying systems
3  *
4  * \copyright Copyright (c) 2014-2018 Governikus GmbH & Co. KG, Germany
5  */
6 
7 #pragma once
8 
9 #include <QCoreApplication>
10 #include <QStringBuilder>
11 #include <QLibraryInfo>
12 
13 namespace governikus
14 {
15 
17 {
18  private:
19  FileDestination() = delete;
20  ~FileDestination() = delete;
21  Q_DISABLE_COPY(FileDestination)
22 
23  static QString getPath()
24  {
25  #ifdef Q_OS_ANDROID
26  return QStringLiteral("assets:");
27 
28  #elif defined(Q_OS_LINUX)
29  return QStringLiteral("/usr/share/AusweisApp2");
30 
31  #else
32  return QCoreApplication::applicationDirPath();
33 
34  #endif
35  }
36 
37 
38  public:
39  static QString getPath(const QString& pFilename)
40  {
41  #if defined(Q_OS_LINUX)
42  if (pFilename.compare(QStringLiteral("translations")) == 0)
43  return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
44  else
45  #endif
46  return getPath() % QLatin1Char('/') % pFilename;
47  }
48 
49 
50  static QString getPath(const char* pFilename)
51  {
52  #if defined(Q_OS_LINUX)
53  if (strcmp(pFilename, "translations") == 0)
54  return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
55  else
56  #endif
57  return getPath() % QLatin1Char('/') % QString::fromUtf8(pFilename);
58  }
59 
60 
61 };
62 
63 } /* namespace governikus */
static QString getPath(const char *pFilename)
Definition: FileDestination.h:50
Definition: FileDestination.h:16
static QString getPath(const QString &pFilename)
Definition: FileDestination.h:39