Fix cache and config folders for ubuntu touch. This only allows write access to ~/.local/share. So config is stored under ~/.local/share/$app/config and cache ~/.local/share/$app/cache
This commit is contained in:
committed by
craig.p.drummond
parent
a61874f11d
commit
110303e223
@@ -663,7 +663,9 @@ static QString userDir(const QString &mainDir, const QString &sub, bool create)
|
||||
|
||||
QString Utils::configDir(const QString &sub, bool create)
|
||||
{
|
||||
#if defined Q_OS_WIN
|
||||
#ifdef ENABLE_UBUNTU
|
||||
return userDir(QDir::homePath()+"/local/share"+constDirSep+FOLDER_NAME+constDirSep+"config"+constDirSep, sub, create);
|
||||
#elif defined Q_OS_WIN
|
||||
return userDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)+constDirSep, sub, create);
|
||||
#else
|
||||
QString env = qgetenv("XDG_CONFIG_HOME");
|
||||
@@ -673,7 +675,9 @@ QString Utils::configDir(const QString &sub, bool create)
|
||||
|
||||
QString Utils::dataDir(const QString &sub, bool create)
|
||||
{
|
||||
#if defined Q_OS_WIN
|
||||
#ifdef ENABLE_UBUNTU
|
||||
return userDir(QDir::homePath()+"/local/share"+constDirSep+FOLDER_NAME+constDirSep, sub, create);
|
||||
#elif defined Q_OS_WIN
|
||||
return userDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)+constDirSep, sub, create);
|
||||
#else
|
||||
QString env = qgetenv("XDG_DATA_HOME");
|
||||
@@ -683,16 +687,14 @@ QString Utils::dataDir(const QString &sub, bool create)
|
||||
|
||||
QString Utils::cacheDir(const QString &sub, bool create)
|
||||
{
|
||||
#if defined Q_OS_WIN
|
||||
#ifdef ENABLE_UBUNTU
|
||||
return userDir(QDir::homePath()+"/local/share"+constDirSep+FOLDER_NAME+constDirSep+"config"+constDirSep, sub, create);
|
||||
#elif defined Q_OS_WIN
|
||||
return userDir(QDesktopServices::storageLocation(QDesktopServices::CacheLocation)+constDirSep, sub, create);
|
||||
#else
|
||||
QString env = qgetenv("XDG_CACHE_HOME");
|
||||
#ifdef ENABLE_UBUNTU
|
||||
return dataDir(".cache", create);
|
||||
#else
|
||||
return userDir((env.isEmpty() ? QDir::homePath() + "/.cache" : env) + constDirSep+FOLDER_NAME+constDirSep, sub, create);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Utils::moveFile(const QString &from, const QString &to)
|
||||
|
||||
Reference in New Issue
Block a user