if(frame.absoluteFile)
editor = (CodeEditor)ide.OpenFile(frame.absoluteFile, false, true, null, no, normal, false);
if(!editor && frame.file)
- frame.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(frame.file);
+ frame.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(frame.file);
if(!frame.absoluteFile && askForLocation && frame.file)
{
char * s = null;
if(SourceDirDialog(title, ide.workspace.projectDir, frame.file, sourceDir))
{
AddSourceDir(sourceDir);
- frame.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(frame.file);
+ frame.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(frame.file);
}
}
if(!editor && frame.absoluteFile)
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))
{
Workspace ws = ide.workspace;
if(ws)
{
- String path = ide.workspace.GetPathWorkspaceRelativeOrAbsolute(item.value);
+ String path = ide.workspace.CopyUnixPathWorkspaceRelativeOrAbsolute(item.value);
if(strcmp(frame.file, path))
frame.file = path;
delete path;
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;
{
CodeLocation codloc { line = line };
codloc.file = CopyString(loc);
- codloc.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(loc);
+ codloc.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(loc);
return codloc;
}
}
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;
-}