From 1f08721ddab4f93c2f3532e4dc01dc98ebffba65 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 20 Aug 2019 22:16:38 +0200 Subject: [PATCH] Remove ConfigFile::locateConfigFile() Needed adjustments to support the config suffix feature. Since it is only used by videodownloader it can be dropped. --- resources/resources.cpp | 59 ----------------------------------------- resources/resources.h | 5 ---- 2 files changed, 64 deletions(-) diff --git a/resources/resources.cpp b/resources/resources.cpp index 3d06ab0..98c9fdd 100644 --- a/resources/resources.cpp +++ b/resources/resources.cpp @@ -298,63 +298,4 @@ bool hasCoreApp() } } // namespace ApplicationInstances -/*! - * \brief Provides convenience functions for handling config files. - */ -namespace ConfigFile { - -/*! - * \brief Locates the config file with the specified \a fileName for the - * application with the specified \a applicationName. - * \remarks If \a settings is not nullptr, the path provided by that object is - * also considered. - */ -QString locateConfigFile(const QString &applicationName, const QString &fileName, const QSettings *settings) -{ - // check whether the file is in the current working directory - if (QFile::exists(fileName)) { - return fileName; - } else { - // check whether the file is in the settings directory used by QSettings - QString path; - if (settings) { - path = QFileInfo(settings->fileName()).absoluteDir().absoluteFilePath(fileName); - if (QFile::exists(path)) { - return path; - } - } -// check whether there is a user created version of the file under /etc/app/ -#ifdef Q_OS_WIN32 - // use relative paths on Windows - path = QStringLiteral("../etc/") % applicationName % QChar('/') % fileName; - if (QFile::exists(path)) { - return path; - } else { - // check whether there is the default version of the file under - // /usr/share/app/ - path = QStringLiteral("../share/") % applicationName % QChar('/') % fileName; - if (QFile::exists(path)) { - return path; - } else { - return QString(); // file is not present - } - } -#else - path = QStringLiteral("/etc/") % applicationName % QChar('/') % fileName; - if (QFile::exists(path)) { - return path; - } else { - // check whether there is the default version of the file under - // /usr/share/app/ - path = QStringLiteral("/usr/share/") % applicationName % QChar('/') % fileName; - if (QFile::exists(path)) { - return path; - } else { - return QString(); // file is not present - } - } -#endif - } -} -} // namespace ConfigFile } // namespace QtUtilities diff --git a/resources/resources.h b/resources/resources.h index 2ea00a2..2deb30d 100644 --- a/resources/resources.h +++ b/resources/resources.h @@ -59,11 +59,6 @@ QT_UTILITIES_EXPORT bool hasGuiApp(); QT_UTILITIES_EXPORT bool hasCoreApp(); } // namespace ApplicationInstances -namespace ConfigFile { - -QT_UTILITIES_EXPORT QString locateConfigFile(const QString &applicationName, const QString &fileName, const QSettings *settings = nullptr); -} - } // namespace QtUtilities #endif // APPLICATION_UTILITIES_RESOURCES_H