ide; fixed ide rendered useless at compiling when ide binary that's being run is...
authorRejean Loyer <rejean.loyer@gmail.com>
Wed, 6 Mar 2013 02:19:49 +0000 (21:19 -0500)
committerJerome St-Louis <jerome@ecere.com>
Wed, 6 Mar 2013 13:29:57 +0000 (08:29 -0500)
epj2make/epj2make.ec
ide/src/ide.ec
ide/src/project/Project.ec
ide/src/project/ProjectView.ec

index 7efc38a..9e726b1 100644 (file)
@@ -360,7 +360,7 @@ class epj2makeApp : GuiApplication
                   if(valid)
                   {
                      project.GenerateCompilerCf(defaultCompiler);
-                     project.GenerateCrossPlatformMk();
+                     project.GenerateCrossPlatformMk(null);
                      if(project.GenerateMakefile(makePath, noResources, includemkPath, project.config))
                      {
                         if(makePath)
index 9877539..447568f 100644 (file)
@@ -3047,6 +3047,9 @@ class IDEApp : GuiApplication
    // driver = "OpenGL";
    // skin = "Aqua";
    //skin = "TVision";
+
+   TempFile includeFile { };
+
    bool Init()
    {
       SetLoggingMode(stdOut, null);
@@ -3073,8 +3076,34 @@ class IDEApp : GuiApplication
          ide.OpenFile(fullPath, (app.argc == 2) * maximized, true, null, yes, normal);
       }
       */
+
+      if(!LoadIncludeFile())
+         PrintLn("error: unable to load :crossplatform.mk file inside ide binary.");
+
       return true;
    }
+
+   bool LoadIncludeFile()
+   {
+      bool result = false;
+      File include = FileOpen(":crossplatform.mk", read);
+      if(include)
+      {
+         File f = includeFile;
+         if(f)
+         {
+            for(; !include.Eof(); )
+            {
+               char buffer[4096];
+               int count = include.Read(buffer, 1, 4096);
+               f.Write(buffer, 1, count);
+            }
+            result = true;
+         }
+         delete include;
+      }
+      return result;
+   }
 }
 
 IDEMainFrame ideMainFrame { };
index 92fe195..defd0b1 100644 (file)
@@ -2033,7 +2033,7 @@ private:
       }
    }
 
-   bool GenerateCrossPlatformMk()
+   bool GenerateCrossPlatformMk(File altCrossPlatformMk)
    {
       bool result = false;
       char path[MAX_LOCATION];
@@ -2056,12 +2056,13 @@ private:
       if(FileExists(path))
          DeleteFile(path);
       {
-         File include = FileOpen(":crossplatform.mk", read);
+         File include = altCrossPlatformMk ? altCrossPlatformMk : FileOpen(":crossplatform.mk", read);
          if(include)
          {
             File f = FileOpen(path, write);
             if(f)
             {
+               include.Seek(0, start);
                for(; !include.Eof(); )
                {
                   char buffer[4096];
@@ -2072,7 +2073,8 @@ private:
 
                result = true;
             }
-            delete include;
+            if(!altCrossPlatformMk)
+               delete include;
          }
       }
       return result;
index 8d63cdf..57b7118 100644 (file)
@@ -613,7 +613,7 @@ class ProjectView : Window
 
    bool ProjectPrepareCompiler(Project project, CompilerConfig compiler)
    {
-      if(!project.GenerateCrossPlatformMk() || !project.GenerateCompilerCf(compiler))
+      if(!project.GenerateCrossPlatformMk(app.includeFile) || !project.GenerateCompilerCf(compiler))
          ide.outputView.buildBox.Logf($"Error generating compiler configuration (Is the project/config directory writable?)\n");
       return true;
    }