char relativeFilePath[MAX_LOCATION];
_dpcl(_dpct, dplchan::debuggerCall, 0, "Debugger::RunToCursor()");
_ChangeUserAction(runToCursor);
- WorkspaceGetRelativePath(absoluteFilePath, relativeFilePath, null);
+ ide.workspace.GetRelativePath(absoluteFilePath, relativeFilePath, null);
if(bpRunToCursor && bpRunToCursor.inserted && symbols)
{
Project owner;
char relativePath[MAX_LOCATION];
- WorkspaceGetRelativePath(absolutePath, relativePath, &owner);
+ ide.workspace.GetRelativePath(absolutePath, relativePath, &owner);
if(!owner && !FileExists(absolutePath))
{
GdbExecCommon();
if(absoluteFilePath)
{
- WorkspaceGetRelativePath(absoluteFilePath, relativeFilePath, null);
+ ide.workspace.GetRelativePath(absoluteFilePath, relativeFilePath, null);
if(!GdbCommand(0.1, true, "-exec-until %s:%d", relativeFilePath, lineNumber))
{
GetLastDirectory(relativeFilePath, relativeFilePath);
GdbExecCommon();
if(lineNumber)
{
- WorkspaceGetRelativePath(absoluteFilePathOrLocation, relativeFilePath, null);
+ ide.workspace.GetRelativePath(absoluteFilePathOrLocation, relativeFilePath, null);
if(!GdbCommand(0.1, true, "advance %s:%d", relativeFilePath, lineNumber)) // should use -exec-advance -- GDB/MI implementation missing
{
GetLastDirectory(relativeFilePath, relativeFilePath);
{
if(!strcmp(prjName, prj.name))
{
- if(ProjectGetAbsoluteFromRelativePath(prj, filePath, fullPath))
+ if(prj.GetAbsoluteFromRelativePath(filePath, fullPath))
{
property::absoluteFilePath = fullPath;
project = prj;
else
{
Project prj = ide.project;
- if(ProjectGetAbsoluteFromRelativePath(prj, filePath, fullPath))
+ if(prj.GetAbsoluteFromRelativePath(filePath, fullPath))
{
property::absoluteFilePath = fullPath;
project = prj;
exp.type = constantExp;
}
}
-
-static Project WorkspaceGetFileOwner(const char * absolutePath)
-{
- Project owner = null;
- for(prj : ide.workspace.projects)
- {
- if(prj.topNode.FindByFullPath(absolutePath, false))
- {
- owner = prj;
- break;
- }
- }
- if(!owner)
- WorkspaceGetObjectFileNode(absolutePath, &owner);
- return owner;
-}
-
-static ProjectNode WorkspaceGetObjectFileNode(const char * filePath, Project * project)
-{
- ProjectNode node = null;
- char ext[MAX_EXTENSION];
- GetExtension(filePath, ext);
- if(ext[0])
- {
- IntermediateFileType type = IntermediateFileType::FromExtension(ext);
- if(type)
- {
- char fileName[MAX_FILENAME];
- GetLastDirectory(filePath, fileName);
- if(fileName[0])
- {
- DotMain dotMain = DotMain::FromFileName(fileName);
- for(prj : ide.workspace.projects)
- {
- if((node = prj.FindNodeByObjectFileName(fileName, type, dotMain, null)))
- {
- if(project)
- *project = prj;
- break;
- }
- }
- }
- }
- }
- return node;
-}
-
-static ProjectNode ProjectGetObjectFileNode(Project project, const char * filePath)
-{
- ProjectNode node = null;
- char ext[MAX_EXTENSION];
- GetExtension(filePath, ext);
- if(ext[0])
- {
- IntermediateFileType type = IntermediateFileType::FromExtension(ext);
- if(type)
- {
- char fileName[MAX_FILENAME];
- GetLastDirectory(filePath, fileName);
- if(fileName[0])
- {
- DotMain dotMain = DotMain::FromFileName(fileName);
- node = project.FindNodeByObjectFileName(fileName, type, dotMain, null);
- }
- }
- }
- return node;
-}
-
-static void WorkspaceGetRelativePath(const char * absolutePath, char * relativePath, Project * owner)
-{
- Project prj = WorkspaceGetFileOwner(absolutePath);
- if(owner)
- *owner = prj;
- if(!prj)
- prj = ide.workspace.projects.firstIterator.data;
- if(prj)
- {
- MakePathRelative(absolutePath, prj.topNode.path, relativePath);
- MakeSlashPath(relativePath);
- }
- else
- relativePath[0] = '\0';
-}
-
-static bool ProjectGetAbsoluteFromRelativePath(Project project, const char * relativePath, char * absolutePath)
-{
- ProjectNode node = project.topNode.FindWithPath(relativePath, false);
- if(!node)
- node = ProjectGetObjectFileNode(project, relativePath);
- if(node)
- {
- strcpy(absolutePath, node.project.topNode.path);
- PathCat(absolutePath, relativePath);
- MakeSlashPath(absolutePath);
- }
- return node != null;
-}
FileAttribs fileAttribs;
// support for valgrind output
- if((s = strstr(text, "==")) && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":")))
+ if((s = strstr(text, "==")) && s == text && (s = strstr(s+2, "==")) && (s = strstr(s+2, ":")) && (s = strstr(s+1, ":")))
{
colon = s;
for(; s>text; s--)
}
if(!done)
{
+ Project project;
+ ProjectNode node;
for(p : ide.workspace.projects)
{
- ProjectNode node = p.topNode.Find(filePath, false);
- if(node)
+ if((node = p.topNode.Find(filePath, false)))
{
node.GetFullFilePath(completePath);
if((fileAttribs = FileExists(completePath)).isFile)
}
}
}
+ if(!node && (node = workspace.GetObjectFileNode(filePath, &project, completePath)) && project &&
+ (fileAttribs = FileExists(completePath)).isFile)
+ CodeLocationGoTo(completePath, fileAttribs, line, col);
}
}
}
}
#ifndef MAKEFILE_GENERATOR
+ ProjectNode GetObjectFileNode(const char * filePath)
+ {
+ ProjectNode node = null;
+ char ext[MAX_EXTENSION];
+ GetExtension(filePath, ext);
+ if(ext[0])
+ {
+ IntermediateFileType type = IntermediateFileType::FromExtension(ext);
+ if(type)
+ {
+ char fileName[MAX_FILENAME];
+ GetLastDirectory(filePath, fileName);
+ if(fileName[0])
+ {
+ DotMain dotMain = DotMain::FromFileName(fileName);
+ node = FindNodeByObjectFileName(fileName, type, dotMain, null);
+ }
+ }
+ }
+ return node;
+ }
+
+ bool GetAbsoluteFromRelativePath(const char * relativePath, char * absolutePath)
+ {
+ ProjectNode node = topNode.FindWithPath(relativePath, false);
+ if(!node)
+ node = GetObjectFileNode(relativePath);
+ if(node)
+ {
+ strcpy(absolutePath, node.project.topNode.path);
+ PathCat(absolutePath, relativePath);
+ MakeSlashPath(absolutePath);
+ }
+ return node != null;
+ }
+
void MarkChanges(ProjectNode node)
{
for(cfg : topNode.configurations)
return nodes;
}
+ Project GetFileOwner(const char * absolutePath)
+ {
+ Project owner = null;
+ for(prj : projects)
+ {
+ if(prj.topNode.FindByFullPath(absolutePath, false))
+ {
+ owner = prj;
+ break;
+ }
+ }
+ if(!owner)
+ GetObjectFileNode(absolutePath, &owner, null);
+ return owner;
+ }
+
+ void GetRelativePath(const char * absolutePath, char * relativePath, Project * owner)
+ {
+ Project prj = GetFileOwner(absolutePath);
+ if(owner)
+ *owner = prj;
+ if(!prj)
+ prj = projects.firstIterator.data;
+ if(prj)
+ {
+ MakePathRelative(absolutePath, prj.topNode.path, relativePath);
+ MakeSlashPath(relativePath);
+ }
+ else
+ relativePath[0] = '\0';
+ }
+
+ ProjectNode GetObjectFileNode(const char * filePath, Project * project, char * fullPath)
+ {
+ ProjectNode node = null;
+ char ext[MAX_EXTENSION];
+ GetExtension(filePath, ext);
+ if(ext[0])
+ {
+ IntermediateFileType type = IntermediateFileType::FromExtension(ext);
+ if(type)
+ {
+ char fileName[MAX_FILENAME];
+ GetLastDirectory(filePath, fileName);
+ if(fileName[0])
+ {
+ DotMain dotMain = DotMain::FromFileName(fileName);
+ for(prj : ide.workspace.projects)
+ {
+ if((node = prj.FindNodeByObjectFileName(fileName, type, dotMain, null)))
+ {
+ if(project)
+ *project = prj;
+ if(fullPath)
+ {
+ const char * cfgName = prj.config ? prj.config.name : "";
+ char name[MAX_FILENAME];
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(prj.lastBuildCompilerName);
+ DirExpression objDir = prj.GetObjDir(compiler, prj.config, bitDepth);
+ strcpy(fullPath, prj.topNode.path);
+ PathCatSlash(fullPath, objDir.dir);
+ node.GetObjectFileName(name, prj.configsNameCollisions[cfgName], type, dotMain);
+ PathCatSlash(fullPath, name);
+ delete objDir;
+ delete compiler;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ return node;
+ }
+
OpenedFileInfo UpdateOpenedFileInfo(const char * fileName, OpenedFileState state)
{
char filePath[MAX_LOCATION];