GUI: Ensure native path separators in reports.
Ensure that native separators are used in saved reports. Reports may be parsed by other programs/scripts so it is important that paths are properly formatted.
This commit is contained in:
parent
c606dc8403
commit
93bfa24d3e
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include "csvreport.h"
|
||||
|
@ -59,7 +60,8 @@ void CsvReport::WriteError(const ErrorItem &error)
|
|||
*/
|
||||
|
||||
QString line;
|
||||
line += QString("%1,%2,").arg(error.files[error.files.size() - 1]).arg(error.lines[error.lines.size() - 1]);
|
||||
const QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
|
||||
line += QString("%1,%2,").arg(file).arg(error.lines[error.lines.size() - 1]);
|
||||
line += QString("%1,%2").arg(error.severity).arg(error.msg);
|
||||
|
||||
mTxtWriter << line << endl;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include "txtreport.h"
|
||||
|
@ -62,7 +63,8 @@ void TxtReport::WriteError(const ErrorItem &error)
|
|||
|
||||
for (int i = 0; i < error.lines.size(); i++)
|
||||
{
|
||||
line += QString("[%1:%2]").arg(error.files[i]).arg(error.lines[i]);
|
||||
const QString file = QDir::toNativeSeparators(error.files[i]);
|
||||
line += QString("[%1:%2]").arg(file).arg(error.lines[i]);
|
||||
if (i < error.lines.size() - 1 && error.lines.size() > 0)
|
||||
{
|
||||
line += " -> ";
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QDebug>
|
||||
|
@ -88,7 +89,8 @@ void XmlReport::WriteError(const ErrorItem &error)
|
|||
*/
|
||||
|
||||
mXmlWriter->writeStartElement(ErrorElementName);
|
||||
mXmlWriter->writeAttribute(FilenameAttribute, error.files[error.files.size() - 1]);
|
||||
const QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
|
||||
mXmlWriter->writeAttribute(FilenameAttribute, file);
|
||||
const QString line = QString::number(error.lines[error.lines.size() - 1]);
|
||||
mXmlWriter->writeAttribute(LineAttribute, line);
|
||||
mXmlWriter->writeAttribute(IdAttribute, error.id);
|
||||
|
|
Loading…
Reference in New Issue