From e853a19fd919c5063e9c36b9b724fe004ab6fc9c Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 4 Mar 2013 21:34:18 -0500 Subject: [PATCH] ide;OutputView; try to find a file in all project dirs if default resolution fails to find a file. --- ide/src/ide.ec | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/ide/src/ide.ec b/ide/src/ide.ec index 562de3e..cc67d2c 100644 --- a/ide/src/ide.ec +++ b/ide/src/ide.ec @@ -2517,23 +2517,44 @@ class IDEWorkSpace : Window completePath[0] = '\0'; PathCat(completePath, filePath); + if((fileAttribs = FileExists(completePath))) + CodeLocationGoTo(completePath, fileAttribs, line, col); + else + { + for(p : ide.workspace.projects) + { + strcpy(completePath, p.topNode.path); + PathCat(completePath, filePath); + if((fileAttribs = FileExists(completePath))) + { + CodeLocationGoTo(completePath, fileAttribs, line, col); + break; + } + } + } + } + } - fileAttribs = FileExists(completePath); - if(fileAttribs.isFile) + void CodeLocationGoTo(const char * path, const FileAttribs fileAttribs, int line, int col) + { + if(fileAttribs.isFile) + { + CodeEditor codeEditor = (CodeEditor)OpenFile(path, normal, true, "", no, normal, false); + if(codeEditor && line) { char ext[MAX_EXTENSION]; - GetExtension(completePath, ext); + GetExtension(path, ext); if(!strcmp(ext, "mp3") || !strcmp(ext, "flac") || !strcmp(ext, "ogg") || !strcmp(ext, "avi") || !strcmp(ext, "mkv")) - ShellOpen(completePath); + ShellOpen(path); else if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll") || !strcmp(ext, "exe")) { char dirPath[MAX_LOCATION]; - StripLastDirectory(completePath, dirPath); + StripLastDirectory(path, dirPath); ShellOpen(dirPath); } else { - CodeEditor codeEditor = (CodeEditor)OpenFile(completePath, normal, true, "", no, normal, false); + CodeEditor codeEditor = (CodeEditor)OpenFile(path, normal, true, "", no, normal, false); if(codeEditor && line) { EditBox editBox = codeEditor.editBox; @@ -2543,7 +2564,7 @@ class IDEWorkSpace : Window } } else if(fileAttribs.isDirectory) - ShellOpen(completePath); + ShellOpen(path); } } -- 1.8.3.1