Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
75d1c4f4
Commit
75d1c4f4
authored
Sep 23, 2010
by
hjk
Browse files
generichighlighter: search more alternative locations
parent
75048873
Changes
1
Show whitespace changes
Inline
Side-by-side
src/plugins/texteditor/generichighlighter/highlightersettings.cpp
View file @
75d1c4f4
...
@@ -45,26 +45,28 @@ namespace Internal {
...
@@ -45,26 +45,28 @@ namespace Internal {
QString
findDefinitionsLocation
()
QString
findDefinitionsLocation
()
{
{
QString
definitionsLocation
;
#ifdef Q_OS_UNIX
#ifdef Q_OS_UNIX
static
const
QLatin1String
kateSyntax
(
"/share/apps/katepart/syntax"
);
static
const
QLatin1String
kateSyntax
[]
=
{
QLatin1String
(
"/share/apps/katepart/syntax"
),
QLatin1String
(
"/share/kde4/apps/katepart/syntax"
)
};
static
const
int
kateSyntaxCount
=
sizeof
(
kateSyntax
)
/
sizeof
(
kateSyntax
[
0
]);
// Some wild guesses.
// Some wild guesses.
QDir
dir
;
QDir
dir
;
for
(
unsigned
i
=
0
;
i
<
kateSyntaxCount
;
++
i
)
{
QStringList
paths
;
QStringList
paths
;
paths
<<
QLatin1String
(
"/usr"
)
+
kateSyntax
paths
<<
QLatin1String
(
"/usr"
)
+
kateSyntax
[
i
]
<<
QLatin1String
(
"/usr/local"
)
+
kateSyntax
<<
QLatin1String
(
"/usr/local"
)
+
kateSyntax
[
i
]
<<
QLatin1String
(
"/opt"
)
+
kateSyntax
;
<<
QLatin1String
(
"/opt"
)
+
kateSyntax
[
i
]
;
foreach
(
const
QString
&
path
,
paths
)
{
foreach
(
const
QString
&
path
,
paths
)
{
dir
.
setPath
(
path
);
dir
.
setPath
(
path
);
if
(
dir
.
exists
())
{
if
(
dir
.
exists
())
definitionsLocation
=
path
;
return
dir
.
path
();
break
;
}
}
}
}
if
(
definitionsLocation
.
isEmpty
())
{
// Try kde-config.
// Try kde-config.
QStringList
programs
;
QStringList
programs
;
programs
<<
QLatin1String
(
"kde-config"
)
<<
QLatin1String
(
"kde4-config"
);
programs
<<
QLatin1String
(
"kde-config"
)
<<
QLatin1String
(
"kde4-config"
);
...
@@ -75,17 +77,16 @@ QString findDefinitionsLocation()
...
@@ -75,17 +77,16 @@ QString findDefinitionsLocation()
process
.
waitForFinished
(
5000
);
process
.
waitForFinished
(
5000
);
QString
output
=
QString
::
fromLocal8Bit
(
process
.
readAllStandardOutput
());
QString
output
=
QString
::
fromLocal8Bit
(
process
.
readAllStandardOutput
());
output
.
remove
(
QLatin1Char
(
'\n'
));
output
.
remove
(
QLatin1Char
(
'\n'
));
dir
.
setPath
(
output
+
kateSyntax
);
for
(
unsigned
i
=
0
;
i
<
kateSyntaxCount
;
++
i
)
{
if
(
dir
.
exists
())
{
dir
.
setPath
(
output
+
kateSyntax
[
i
]);
definitionsLocation
=
dir
.
path
();
if
(
dir
.
exists
())
break
;
return
dir
.
path
();
}
}
}
}
}
}
}
#endif
#endif
return
definitionsLocation
;
return
QString
()
;
}
}
}
// namespace Internal
}
// namespace Internal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment