Go to the documentation of this file.
6 #include <QCoreApplication>
9 #include <QStandardPaths>
10 #include <sys/statfs.h>
33 confdir = qgetenv(
"MYTHCONFDIR" );
37 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Read conf dir = %1").arg(
confdir));
38 confdir.replace(
"$HOME", QDir::homePath());
52 QDir sDir(qgetenv(
"ProgramData") +
"\\mythtv\\");
53 sharedir = sDir.canonicalPath() +
"/";
56 confdir = qgetenv(
"LOCALAPPDATA" ) +
"\\mythtv";
66 qApp->setOrganizationName(
"mythtv" );
68 QStringList lstPaths = QStandardPaths::standardLocations(
69 QStandardPaths::DataLocation);
73 if (lstPaths.length() > 0)
75 QString sAppName = qApp->applicationName();
87 if (
confdir.endsWith( sAppName ))
97 #elif defined(Q_OS_ANDROID)
101 QString extdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
"/Mythtv";
102 if (!QDir(extdir).exists())
103 QDir(extdir).mkdir(
".");
106 confdir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
110 QStringList appLocs = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
111 uint64_t maxFreeSpace = 0;
112 for(
auto s : appLocs)
115 memset(&statFs, 0,
sizeof(statFs));
116 int ret =
statfs(s.toLocal8Bit().data(), &statFs);
117 if (ret == 0 && statFs.
f_bavail >= maxFreeSpace)
122 LOG(VB_GENERAL, LOG_NOTICE, QString(
" appdatadir = %1 (%2, %3, %4)")
128 QStringList cacheLocs = QStandardPaths::standardLocations(QStandardPaths::CacheLocation);
130 for(
auto s : cacheLocs)
133 memset(&statFs, 0,
sizeof(statFs));
134 int ret =
statfs(s.toLocal8Bit().data(), &statFs);
135 if (ret == 0 && statFs.
f_bavail >= maxFreeSpace)
140 LOG(VB_GENERAL, LOG_NOTICE, QString(
" cachedir = %1 (%2, %3, %4)")
158 QDir prefixDir = qApp->applicationDirPath();
166 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Relative PREFIX! (%1), appDir=%2")
171 LOG(VB_GENERAL, LOG_ERR,
172 QString(
"Relative PREFIX does not resolve, using %1")
173 .arg(prefixDir.canonicalPath()));
185 confdir = QDir::homePath() +
"/.mythtv";
191 #if defined(Q_OS_ANDROID)
204 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Using configuration directory = %1")
208 LOG(VB_GENERAL, LOG_DEBUG,
"sharedir = "+
sharedir );
209 LOG(VB_GENERAL, LOG_DEBUG,
"libdir = "+
libdir );
210 LOG(VB_GENERAL, LOG_DEBUG,
"themedir = "+
themedir );
214 LOG(VB_GENERAL, LOG_DEBUG,
"cachedir = "+
cachedir );
266 #elif defined(_WIN32)
271 #elif defined(Q_OS_ANDROID)
300 return "mythfrontend_*.qm";
306 +
"mythfrontend_" + translation.toLower() +
".qm";
QString GetThemesParentDir(void)
static QString installprefix
static const QString kFilterLibSuffix
QString GetLibraryDir(void)
QString GetFontsDir(void)
static const QString kPluginLibPrefix
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString GetPluginsDir(void)
QString GetCacheDir(void)
Returns the base directory for all cached files.
void InitializeMythDirs(void)
QString GetFiltersNameFilter(void)
QString GetInstallPrefix(void)
static QString themebasecachedir
QString GetPluginsNameFilter(void)
int statfs(const char *path, struct statfs *buffer)
QString GetShareDir(void)
QString GetThemeBaseCacheDir(void)
Returns the base directory where all theme related files should be cached.
static QString translationsdir
static const QString kFilterLibPrefix
QString GetThumbnailDir(void)
Returns the directory where all non-theme thumbnail files should be cached.
QString GetRemoteCacheDir(void)
Returns the directory for all files cached from the backend.
QString GetFiltersDir(void)
static QString remotecachedir
QString GetAppBinDir(void)
static QString filtersdir
static QString pluginsdir
static QString thumbnaildir
static const QString kPluginLibSuffix
QString GetTranslationsDir(void)
QString FindPluginName(const QString &plugname)
QString GetTranslationsNameFilter(void)
QString FindTranslation(const QString &translation)