ide: support compiler config environment variables in project node paths.
authorRejean Loyer <redj@ecere.com>
Mon, 27 Jul 2015 20:35:02 +0000 (16:35 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 22 Dec 2015 05:06:09 +0000 (00:06 -0500)
ide/src/debugger/Debugger.ec
ide/src/dialogs/FindInFilesDialog.ec
ide/src/dialogs/NodeProperties.ec
ide/src/ide.ec
ide/src/project/Project.ec
ide/src/project/ProjectNode.ec
ide/src/project/ProjectView.ec
ide/src/project/Workspace.ec

index 6d19835..abd326d 100644 (file)
@@ -1805,7 +1805,7 @@ class Debugger
                            {
                               char path[MAX_LOCATION];
                               char relative[MAX_LOCATION];
-                              node.GetFullFilePath(path);
+                              node.GetFullFilePath(path, false);
                               bp.absoluteFilePath = path;
                               MakePathRelative(path, prj.topNode.path, relative);
                               bp.relativeFilePath = relative;
index 1191717..f1266a8 100644 (file)
@@ -259,7 +259,7 @@ private:
                DataRow r = null;
                ProjectNode node = prj.topNode;
                char filePath[MAX_LOCATION];
-               prj.topNode.GetFullFilePath(filePath);
+               prj.topNode.GetFullFilePath(filePath, false);
                lastSelectionProject = CopyString(filePath);
                findWherePrjNode.Clear();
                ListProjectNodeFolders(node, null);
@@ -318,7 +318,7 @@ private:
             if(node)
             {
                char filePath[MAX_LOCATION];
-               node.GetFullFilePath(filePath);
+               node.GetFullFilePath(filePath, true);
                lastSelectionProjectNode = CopyString(filePath);
             }
          }
@@ -466,7 +466,7 @@ private:
                Project p = (Project)(intptr)row.tag;
                if(p)
                {
-                  p.topNode.GetFullFilePath(filePath);
+                  p.topNode.GetFullFilePath(filePath, false);
                   if(!fstrcmp(filePath, lastSelectionProject))
                      break;
                }
index 0f7ece0..4cc58dc 100644 (file)
@@ -183,7 +183,7 @@ class NodeProperties : Window
             {
                char filePath[MAX_LOCATION];
                Window document;
-               node.GetFullFilePath(filePath);
+               node.GetFullFilePath(filePath, true);
                if(FileExists(filePath))
                   ide.projectView.OpenNode(node, key.ctrl && key.shift);
                else
index 673aadb..9614ba0 100644 (file)
@@ -2712,7 +2712,7 @@ class IDEWorkSpace : Window
                {
                   if((n = p.topNode.Find(filePath, false)))
                   {
-                     n.GetFullFilePath(selectedPath);
+                     n.GetFullFilePath(selectedPath, true);
                      if((fileAttribs = FileExists(selectedPath)).isFile)
                      {
                         if(node) *node = n;
index 99a053d..6ff0ff2 100644 (file)
@@ -688,6 +688,15 @@ CompilerConfig GetCompilerConfig()
 #endif
 }
 
+int GetBitDepth()
+{
+#ifdef MAKEFILE_GENERATOR
+   return 0; // todo: improve this somehow? add bit depth command line option?
+#else
+   return ide.workspace.bitDepth;
+#endif
+}
+
 define localTargetType = config && config.options && config.options.targetType ?
             config.options.targetType : options && options.targetType ?
             options.targetType : TargetTypes::executable;
index c81f067..02f6e44 100644 (file)
@@ -10,7 +10,7 @@ import "ecere"
 import "Project"
 
 static define app = ((GuiApplication)__thisModule);
-#endif
+#endif // #ifndef MAKEFILE_GENERATOR
 
 #define OPTION(x) ((uint)(uintptr)(&((ProjectOptions)0).x))
 
@@ -20,7 +20,7 @@ static void OutputLog(const char * string)
    printf("%s", string);
 #else
    ide.outputView.buildBox.Log(string);
-#endif
+#endif // #ifdef MAKEFILE_GENERATOR
 }
 
 bool eString_PathInsideOfMore(const char * path, const char * of, char * pathRest)
@@ -518,13 +518,32 @@ private:
       }
    }
 
-   char * GetFullFilePath(char * buffer)
+   char * GetFullFilePath(char * buffer, bool resolveVars)
    {
       if(buffer)
       {
          strcpy(buffer, root.path);
-         PathCatSlash(buffer, path);
-         PathCatSlash(buffer, name);
+         if(resolveVars)
+         {
+            if(path && path[0])
+            {
+               DirExpression pathExp { };
+               Project project = property::project;
+               CompilerConfig compiler = GetCompilerConfig();
+               ProjectConfig config = project.config;
+               int bitDepth = GetBitDepth();
+               pathExp.Evaluate(path, project, compiler, config, bitDepth);
+               PathCatSlash(buffer, pathExp.dir);
+               delete compiler;
+               delete pathExp;
+            }
+            PathCatSlash(buffer, name);
+         }
+         else
+         {
+            PathCatSlash(buffer, path);
+            PathCatSlash(buffer, name);
+         }
       }
       return buffer;
    }
@@ -1118,7 +1137,7 @@ private:
                else if(child.name && !fstrcmp(lastDirName, child.name))
                {
                   char p[MAX_LOCATION];
-                  child.GetFullFilePath(p);
+                  child.GetFullFilePath(p, true);
                   if(!fstrcmp(p, path))
                   {
                      result = child;
@@ -1403,7 +1422,7 @@ private:
          }
       }
    }
-#endif
+#endif // #ifndef MAKEFILE_GENERATOR
 
    int OnCompare(ProjectNode b)
    {
@@ -2434,7 +2453,7 @@ private:
             if(!strcmpi(extension, &h2s))
             {
                char filePath[MAX_LOCATION];
-               GetFullFilePath(filePath);
+               GetFullFilePath(filePath, false);
                OutputLog($"No compilation required for header file "); OutputLog(filePath); OutputLog("\n");
                ChangeExtension(moduleName, h2s, moduleName);
                if(prj.topNode.Find(moduleName, false))
index 8690d11..8d446a2 100644 (file)
@@ -1891,7 +1891,8 @@ class ProjectView : Window
    {
       char filePath[MAX_LOCATION];
       char ext[MAX_EXTENSION];
-      node.GetFullFilePath(filePath);
+      node.GetFullFilePath(filePath, true);
+
       GetExtension(filePath, ext);
       if(binaryDocExt.Find(ext))
       {
@@ -2080,7 +2081,7 @@ class ProjectView : Window
          fileDialog.master = parent;
          while(node)
          {
-            node.GetFullFilePath(path);
+            node.GetFullFilePath(path, false);
             while(path[0])
             {
                StripLastDirectory(path, path);
index 8e3d56e..4a980ba 100644 (file)
@@ -385,7 +385,7 @@ public:
       }
       if(prj)
       {
-         node.GetFullFilePath(absolute);
+         node.GetFullFilePath(absolute, false);
          return CopyString(absolute);
       }