logic: paths in ProjectSettings relative to file not working directory
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.
This commit is contained in:
@@ -20,6 +20,10 @@ ParseLocation::ParseLocation(
|
||||
, endLineNumber(lineNumber)
|
||||
, endColumnNumber(columnNumber)
|
||||
{
|
||||
if (this->filePath.exists())
|
||||
{
|
||||
this->filePath = this->filePath.canonical();
|
||||
}
|
||||
}
|
||||
|
||||
ParseLocation::ParseLocation(
|
||||
@@ -33,9 +37,13 @@ ParseLocation::ParseLocation(
|
||||
, endLineNumber(endLineNumber)
|
||||
, endColumnNumber(endColumnNumber)
|
||||
{
|
||||
if (this->filePath.exists())
|
||||
{
|
||||
this->filePath = this->filePath.canonical();
|
||||
}
|
||||
}
|
||||
|
||||
bool ParseLocation::isValid() const
|
||||
{
|
||||
return filePath.size() > 0;
|
||||
return !filePath.empty();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
struct ParseLocation
|
||||
@@ -21,7 +22,7 @@ struct ParseLocation
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
std::string filePath;
|
||||
FilePath filePath;
|
||||
uint startLineNumber;
|
||||
uint startColumnNumber;
|
||||
uint endLineNumber;
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class FilePath;
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class ParserClient;
|
||||
class TextAccess;
|
||||
|
||||
@@ -16,9 +17,9 @@ public:
|
||||
{
|
||||
Arguments();
|
||||
|
||||
std::vector<std::string> headerSearchPaths;
|
||||
std::vector<std::string> systemHeaderSearchPaths;
|
||||
std::vector<std::string> frameworkSearchPaths;
|
||||
std::vector<FilePath> headerSearchPaths;
|
||||
std::vector<FilePath> systemHeaderSearchPaths;
|
||||
std::vector<FilePath> frameworkSearchPaths;
|
||||
std::vector<std::string> compilerFlags;
|
||||
bool logErrors;
|
||||
};
|
||||
|
||||
@@ -354,7 +354,7 @@ bool ASTVisitor::VisitClassTemplateDecl(clang::ClassTemplateDecl* declaration)
|
||||
getParseLocationForNamedDecl(*it), specializedRecordNameHierarchy, specializedRecordType, specializationParentNameHierarchy
|
||||
);
|
||||
|
||||
std::string specializationFilePath = getParseLocationForNamedDecl(specializationDecl).filePath;
|
||||
std::string specializationFilePath = getParseLocationForNamedDecl(specializationDecl).filePath.str();
|
||||
|
||||
const clang::TemplateArgumentList &argList = specializationDecl->getTemplateArgs();
|
||||
for (size_t i = 0; i < argList.size(); i++)
|
||||
@@ -484,7 +484,7 @@ bool ASTVisitor::VisitFunctionTemplateDecl(clang::FunctionTemplateDecl *declarat
|
||||
{
|
||||
const clang::QualType argumentType = argument.getAsType();
|
||||
m_client->onTemplateArgumentTypeParsed(
|
||||
ParseLocation(specializedFunctionLocation.filePath, 0, 0), // TODO: Find a valid ParseLocation here!
|
||||
ParseLocation(specializedFunctionLocation.filePath.str(), 0, 0), // TODO: Find a valid ParseLocation here!
|
||||
utility::qualTypeToDataType(argumentType)->getTypeNameHierarchy(),
|
||||
specializedFunction.nameHierarchy);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void CxxParser::parseFiles(const std::vector<FilePath>& filePaths, const Argumen
|
||||
std::vector<std::string> sourcePaths;
|
||||
for (const FilePath& path : m_fileRegister->getUnparsedSourceFilePaths())
|
||||
{
|
||||
sourcePaths.push_back(path.absoluteStr());
|
||||
sourcePaths.push_back(path.absolute().str());
|
||||
}
|
||||
|
||||
runTool(sourcePaths);
|
||||
@@ -114,19 +114,19 @@ std::vector<std::string> CxxParser::getCommandlineArguments(const Arguments& arg
|
||||
|
||||
args.insert(args.begin(), arguments.compilerFlags.begin(), arguments.compilerFlags.end());
|
||||
|
||||
for (const std::string& path : arguments.headerSearchPaths)
|
||||
for (const FilePath& path : arguments.headerSearchPaths)
|
||||
{
|
||||
args.push_back("-I" + path);
|
||||
args.push_back("-I" + path.str());
|
||||
}
|
||||
|
||||
for (const std::string& path : arguments.systemHeaderSearchPaths)
|
||||
for (const FilePath& path : arguments.systemHeaderSearchPaths)
|
||||
{
|
||||
args.push_back("-isystem" + path);
|
||||
args.push_back("-isystem" + path.str());
|
||||
}
|
||||
|
||||
for (const std::string& path : arguments.frameworkSearchPaths)
|
||||
for (const FilePath& path : arguments.frameworkSearchPaths)
|
||||
{
|
||||
args.push_back("-iframework" + path);
|
||||
args.push_back("-iframework" + path.str());
|
||||
}
|
||||
|
||||
return args;
|
||||
|
||||
@@ -28,7 +28,7 @@ void TaskParseCxx::enter()
|
||||
|
||||
for (const FilePath& path : m_parser.getFileRegister()->getUnparsedSourceFilePaths())
|
||||
{
|
||||
m_sourcePaths.push(path.absoluteStr());
|
||||
m_sourcePaths.push(path.absolute().str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user