This change checks all paths in the ProjectSettings file for relativity and makes them relative to the location of the ProjectSettings file if necessary. The paths are also correctly saved relative to the file.
50 lines
989 B
C++
50 lines
989 B
C++
#include "data/parser/ParseLocation.h"
|
|
|
|
ParseLocation::ParseLocation()
|
|
: filePath("")
|
|
, startLineNumber(0)
|
|
, startColumnNumber(0)
|
|
, endLineNumber(0)
|
|
, endColumnNumber(0)
|
|
{
|
|
}
|
|
|
|
ParseLocation::ParseLocation(
|
|
const std::string& filePath,
|
|
uint lineNumber,
|
|
uint columnNumber
|
|
)
|
|
: filePath(filePath)
|
|
, startLineNumber(lineNumber)
|
|
, startColumnNumber(columnNumber)
|
|
, endLineNumber(lineNumber)
|
|
, endColumnNumber(columnNumber)
|
|
{
|
|
if (this->filePath.exists())
|
|
{
|
|
this->filePath = this->filePath.canonical();
|
|
}
|
|
}
|
|
|
|
ParseLocation::ParseLocation(
|
|
const std::string& filePath,
|
|
uint startLineNumber, uint startColumnNumber,
|
|
uint endLineNumber, uint endColumnNumber
|
|
)
|
|
: filePath(filePath)
|
|
, startLineNumber(startLineNumber)
|
|
, startColumnNumber(startColumnNumber)
|
|
, endLineNumber(endLineNumber)
|
|
, endColumnNumber(endColumnNumber)
|
|
{
|
|
if (this->filePath.exists())
|
|
{
|
|
this->filePath = this->filePath.canonical();
|
|
}
|
|
}
|
|
|
|
bool ParseLocation::isValid() const
|
|
{
|
|
return !filePath.empty();
|
|
}
|