GUI: Avoid unnecessary path separator conversion.

This commit is contained in:
Kimmo Varis 2010-07-18 11:20:10 +03:00
parent 93bfa24d3e
commit 006c9f17d4
3 changed files with 17 additions and 4 deletions

View File

@ -59,7 +59,7 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
tok != msg._callStack.end();
++tok)
{
files << QString((*tok).getfile().c_str());
files << QString((*tok).getfile(false).c_str());
lines << (*tok).line;
}

View File

@ -216,7 +216,7 @@ std::string ErrorLogger::callStackToString(const std::list<ErrorLogger::ErrorMes
}
std::string ErrorLogger::ErrorMessage::FileLocation::getfile() const
std::string ErrorLogger::ErrorMessage::FileLocation::getfile(bool convert) const
{
std::string f(_file);
@ -246,7 +246,8 @@ std::string ErrorLogger::ErrorMessage::FileLocation::getfile() const
pos = sep;
}
f = Path::toNativeSeparators(f);
if (convert)
f = Path::toNativeSeparators(f);
return f;
}

View File

@ -81,6 +81,8 @@ public:
public:
/**
* File name and line number.
* Internally paths are stored with / separator. When getting the filename
* it is by default converted to native separators.
*/
class FileLocation
{
@ -90,7 +92,17 @@ public:
line = 0;
}
std::string getfile() const;
/**
* Return the filename.
* @param convert If true convert path to native separators.
* @return filename.
*/
std::string getfile(bool convert = true) const;
/**
* Set the filename.
* @param file Filename to set.
*/
void setfile(const std::string &file);
unsigned int line;
private: