Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
1a658090
Commit
1a658090
authored
Mar 22, 2011
by
con
Browse files
Add error reporting if executable is not found for external tool.
parent
90f7ab49
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/externaltool.cpp
View file @
1a658090
...
...
@@ -529,7 +529,8 @@ bool ExternalTool::operator==(const ExternalTool &other) const
ExternalToolRunner
::
ExternalToolRunner
(
const
ExternalTool
*
tool
)
:
m_tool
(
new
ExternalTool
(
tool
)),
m_process
(
0
),
m_outputCodec
(
QTextCodec
::
codecForLocale
())
m_outputCodec
(
QTextCodec
::
codecForLocale
()),
m_hasError
(
false
)
{
run
();
}
...
...
@@ -540,6 +541,16 @@ ExternalToolRunner::~ExternalToolRunner()
delete
m_tool
;
}
bool
ExternalToolRunner
::
hasError
()
const
{
return
m_hasError
;
}
QString
ExternalToolRunner
::
errorString
()
const
{
return
m_errorString
;
}
bool
ExternalToolRunner
::
resolve
()
{
if
(
!
m_tool
)
...
...
@@ -548,14 +559,27 @@ bool ExternalToolRunner::resolve()
m_resolvedArguments
.
clear
();
m_resolvedWorkingDirectory
.
clear
();
{
// executable
QStringList
expandedExecutables
;
/* for error message */
foreach
(
const
QString
&
executable
,
m_tool
->
executables
())
{
QString
resolv
ed
=
Utils
::
expandMacros
(
executable
,
QString
expand
ed
=
Utils
::
expandMacros
(
executable
,
Core
::
VariableManager
::
instance
()
->
macroExpander
());
expandedExecutables
<<
expanded
;
m_resolvedExecutable
=
Utils
::
Environment
::
systemEnvironment
().
searchInPath
(
resolved
);
Utils
::
Environment
::
systemEnvironment
().
searchInPath
(
expanded
);
if
(
!
m_resolvedExecutable
.
isEmpty
())
break
;
}
if
(
m_resolvedExecutable
.
isEmpty
())
if
(
m_resolvedExecutable
.
isEmpty
())
{
m_hasError
=
true
;
for
(
int
i
=
0
;
i
<
expandedExecutables
.
size
();
++
i
)
{
m_errorString
+=
tr
(
"Could not find executable for '%1' (expanded '%2')
\n
"
)
.
arg
(
m_tool
->
executables
().
at
(
i
))
.
arg
(
expandedExecutables
.
at
(
i
));
}
if
(
!
m_errorString
.
isEmpty
())
m_errorString
.
chop
(
1
);
return
false
;
}
}
{
// arguments
m_resolvedArguments
=
Utils
::
QtcProcess
::
expandMacros
(
m_tool
->
arguments
(),
...
...
@@ -759,7 +783,10 @@ void ExternalToolManager::menuActivated()
QTC_ASSERT
(
action
,
return
);
ExternalTool
*
tool
=
m_tools
.
value
(
action
->
data
().
toString
());
QTC_ASSERT
(
tool
,
return
);
new
ExternalToolRunner
(
tool
);
ExternalToolRunner
*
runner
=
new
ExternalToolRunner
(
tool
);
if
(
runner
->
hasError
())
{
ICore
::
instance
()
->
messageManager
()
->
printToOutputPane
(
runner
->
errorString
(),
true
);
}
}
QMap
<
QString
,
QList
<
Internal
::
ExternalTool
*>
>
ExternalToolManager
::
toolsByCategory
()
const
...
...
src/plugins/coreplugin/externaltool.h
View file @
1a658090
...
...
@@ -135,6 +135,9 @@ public:
ExternalToolRunner
(
const
ExternalTool
*
tool
);
~
ExternalToolRunner
();
bool
hasError
()
const
;
QString
errorString
()
const
;
private
slots
:
void
started
();
void
finished
(
int
exitCode
,
QProcess
::
ExitStatus
status
);
...
...
@@ -157,6 +160,8 @@ private:
QTextCodec
::
ConverterState
m_errorCodecState
;
QString
m_processOutput
;
QString
m_expectedFileName
;
bool
m_hasError
;
QString
m_errorString
;
};
}
// Internal
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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