ide; fixed opening generated files from build log (enter/dblclick). also opening...
[sdk] / ide / src / project / ProjectView.ec
index 0791add..f54a3e8 100644 (file)
@@ -1567,9 +1567,10 @@ class ProjectView : Window
          }
          
          {
-            char moduleName[MAX_LOCATION], filePath[MAX_LOCATION];
-            char ext[MAX_EXTENSION];
+            char moduleName[MAX_LOCATION], filePath[MAX_LOCATION] = "";
+            char ext[MAX_EXTENSION] = "";
             char * bracket;
+            ProjectNode node = null;
             if(colon)
             {
                char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
@@ -1586,33 +1587,140 @@ class ProjectView : Window
             else
                strcpy(moduleName, line);
 
+            if(!colon)
+            {
+               char * msg;
+               if((msg = strstr(moduleName, " - ")))
+               {
+                  bool found = false;
+                  msg[0] = '\0';
+                  for(prj : ide.workspace.projects)
+                  {
+                     strcpy(filePath, prj.topNode.path);
+                     PathCatSlash(filePath, moduleName);
+                     if(FileExists(filePath).isFile)
+                     {
+                        found = true;
+                        break;
+                     }
+                  }
+                  if(!found)
+                  {
+                     msg[0] = ' ';
+                     filePath[0] = '\0';
+                  }
+               }
+               else if((msg = strstr(moduleName, "...")) && (colon = strchr(moduleName, ' ')) && (++colon)[0])
+               {
+                  bool found = false;
+                  msg[0] = '\0';
+                  for(prj : ide.workspace.projects)
+                  {
+                     if((node = prj.resNode.Find(colon, true)))
+                     {
+                        strcpy(filePath, prj.topNode.path);
+                        PathCatSlash(filePath, node.path);
+                        PathCatSlash(filePath, node.name);
+
+                        found = true;
+                        break;
+                     }
+                  }
+                  if(!found)
+                  {
+                     msg[0] = '.';
+                     filePath[0] = '\0';
+                  }
+               }
+               colon = null;
+            }
             // Remove stuff in brackets
             /*
             bracket = strstr(moduleName, "(");
             if(bracket) *bracket = '\0';
             */
             MakeSlashPath(moduleName);
+            GetExtension(moduleName, ext);
 
-            if(!colon)
+            if(!colon && !filePath[0])
             {
+               bool dotMain = false;
                // Check if it's one of our modules
-               ProjectNode node = project.topNode.Find(moduleName, false);
+               node = project.topNode.Find(moduleName, false);
                if(node)
                {
-                  strcpy(moduleName, node.path);
-                  PathCatSlash(moduleName, node.name);
+                  strcpy(filePath, node.path);
+                  PathCatSlash(filePath, node.name);
                }
                else
-                  moduleName[0] = '\0';
+               {
+                  IntermediateFileType type = none;
+                  ProjectConfig config;
+                  if(ext[0])
+                  {
+                     char ext2[MAX_EXTENSION];
+                     char stripExt[MAX_LOCATION];
+                     strcpy(stripExt, moduleName);
+                     StripExtension(stripExt);
+                     GetExtension(stripExt, ext2);
+                     if(ext2[0] && !strcmp(ext2, "main"))
+                        dotMain = true;
+                     if(!strcmp(ext, "ec"))
+                        type = ec;
+                     else if(!strcmp(ext, "c"))
+                        type = c;
+                     else if(!strcmp(ext, "sym"))
+                        type = sym;
+                     else if(!strcmp(ext, "imp"))
+                        type = imp;
+                     else if(!strcmp(ext, "bowl"))
+                        type = bowl;
+                     else if(!strcmp(ext, "o"))
+                        type = o;
+
+                     if(type)
+                     {
+                        for(prj : ide.workspace.projects; prj.lastBuildConfigName)
+                        {
+                           if((config = prj.GetConfig(prj.lastBuildConfigName)))
+                              node = prj.FindNodeByObjectFileName(moduleName, type, dotMain, config);
+                           if(node)
+                              break;
+                        }
+                     }
+                  }
+                  if(node)
+                  {
+                     char name[MAX_FILENAME];
+                     Project project = node.project;
+                     CompilerConfig compiler = ideSettings.GetCompilerConfig(project.lastBuildCompilerName);
+                     if(compiler)
+                     {
+                        int bitDepth = ide.workspace.bitDepth;
+                        DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
+                        strcpy(filePath, project.topNode.path);
+                        PathCatSlash(filePath, objDir.dir);
+                        node.GetObjectFileName(name, project.lastBuildNamesInfo, type, dotMain);
+                        PathCatSlash(filePath, name);
+                        delete objDir;
+                     }
+                     delete compiler;
+                  }
+               }
+               if(!node)
+                  filePath[0] = '\0';
             }
-            GetExtension(moduleName, ext);
-            if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") || !strcmp(ext, "dll"))
+            if(!strcmp(ext, "a") || !strcmp(ext, "o") || !strcmp(ext, "lib") ||
+                  !strcmp(ext, "dll") || !strcmp(ext, "exe") || !strcmp(ext, "mo"))
                moduleName[0] = 0;    // Avoid opening binary files
             if(moduleName[0])
             {
                CodeEditor codeEditor;
-               strcpy(filePath, project.topNode.path);
-               PathCatSlash(filePath, moduleName);
+               if(!filePath[0])
+               {
+                  strcpy(filePath, project.topNode.path);
+                  PathCatSlash(filePath, moduleName);
+               }
       
                codeEditor = (CodeEditor)ide.OpenFile(filePath, normal, true, null, no, normal, noParsing);
                if(!codeEditor && !strcmp(ext, "c"))