forked from qt-creator/qt-creator
TextEditor: Remove unused findFallbackDefinitionsLocation()
Change-Id: Ib5c02562087c2ee11b5aa1c19c823cf8fd2af828 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -7,68 +7,11 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace TextEditor {
|
||||
namespace Internal {
|
||||
|
||||
FilePath findFallbackDefinitionsLocation()
|
||||
{
|
||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
|
||||
static const QLatin1String kateSyntaxPaths[] = {
|
||||
QLatin1String("/share/apps/katepart/syntax"),
|
||||
QLatin1String("/share/kde4/apps/katepart/syntax")
|
||||
};
|
||||
|
||||
// Some wild guesses.
|
||||
for (const auto &kateSyntaxPath : kateSyntaxPaths) {
|
||||
const FilePath paths[] = {
|
||||
FilePath("/usr") / kateSyntaxPath,
|
||||
FilePath("/usr/local") / kateSyntaxPath,
|
||||
FilePath("/opt") / kateSyntaxPath
|
||||
};
|
||||
for (const FilePath &path : paths) {
|
||||
if (path.exists() && !path.dirEntries({{"*.xml"}}).isEmpty())
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
// Try kde-config.
|
||||
const FilePath programs[] = {"kde-config", "kde4-config"};
|
||||
for (const FilePath &program : programs) {
|
||||
QtcProcess process;
|
||||
process.setTimeoutS(5);
|
||||
process.setCommand({program, {"--prefix"}});
|
||||
process.runBlocking();
|
||||
if (process.result() == ProcessResult::FinishedWithSuccess) {
|
||||
QString output = process.cleanedStdOut();
|
||||
output.remove('\n');
|
||||
const FilePath dir = FilePath::fromString(output);
|
||||
for (auto &kateSyntaxPath : kateSyntaxPaths) {
|
||||
const FilePath path = dir / kateSyntaxPath;
|
||||
if (path.exists() && !path.dirEntries({{"*.xml"}}).isEmpty())
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const FilePath dir = Core::ICore::resourcePath("generic-highlighter");
|
||||
if (dir.exists() && !dir.dirEntries({{"*.xml"}}).isEmpty())
|
||||
return dir;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
const QLatin1String kDefinitionFilesPath("UserDefinitionFilesPath");
|
||||
const QLatin1String kIgnoredFilesPatterns("IgnoredFilesPatterns");
|
||||
|
@@ -50,8 +50,4 @@ private:
|
||||
QList<QRegularExpression> m_ignoredFiles;
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
Utils::FilePath findFallbackDefinitionsLocation();
|
||||
}
|
||||
|
||||
} // namespace TextEditor
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <QPointer>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace TextEditor::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace TextEditor {
|
||||
@@ -107,6 +106,8 @@ public:
|
||||
|
||||
} // Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
class HighlighterSettingsPagePrivate
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::HighlighterSettingsPage)
|
||||
@@ -129,7 +130,6 @@ public:
|
||||
QPointer<HighlighterSettingsPageWidget> m_widget;
|
||||
};
|
||||
|
||||
|
||||
void HighlighterSettingsPagePrivate::migrateGenericHighlighterFiles()
|
||||
{
|
||||
QDir userDefinitionPath(m_settings.definitionFilesPath().toString());
|
||||
|
Reference in New Issue
Block a user