ソースを参照

Check for fargo.a and flashos.a availability. Refuse to load Fargo resp. Flash OS projects and hide Fargo resp. FlashOS options from the project options if they are missing.

git-svn-id: file:///var/svn/tigccpp/trunk@522 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 年 前
コミット
3af8c3fddf
4 ファイル変更21 行追加0 行削除
  1. 8 0
      ktigcc/ktigcc.cpp
  2. 2 0
      ktigcc/ktigcc.h
  3. 8 0
      ktigcc/mainform.ui.h
  4. 3 0
      ktigcc/projectoptions.ui.h

+ 8 - 0
ktigcc/ktigcc.cpp

@@ -42,6 +42,8 @@ static KCmdLineOptions options[] =
 const char *tigcc_base;
 char tempdir[]="/tmp/ktigccXXXXXX";
 char *quill_drv;
+bool have_fargo;
+bool have_flashos;
 KConfig *pconfig;
 KAboutData *pabout;
 const char *parg;
@@ -114,6 +116,12 @@ int main( int argc, char *argv[] )
   quill_drv=NULL;
   quill_drv_found:
 
+  char runtime_archive[strlen(tigcc_base) + 15];
+  sprintf(runtime_archive, "%s/lib/fargo.a", tigcc_base);
+  have_fargo=(access(runtime_archive, F_OK)!=-1);
+  sprintf(runtime_archive, "%s/lib/flashos.a", tigcc_base);
+  have_flashos=(access(runtime_archive, F_OK)!=-1);
+  
   if (!mkdtemp(tempdir)) exit(1);
   
   KCmdLineArgs *args=KCmdLineArgs::parsedArgs();

+ 2 - 0
ktigcc/ktigcc.h

@@ -25,6 +25,8 @@
 
 extern const char *tigcc_base;
 extern const char *quill_drv;
+extern bool have_fargo;
+extern bool have_flashos;
 extern char tempdir[];
 extern void write_temp_file(const char *filename, const char *data, const size_t len);
 extern void delete_temp_file(const char *filename);

+ 8 - 0
ktigcc/mainform.ui.h

@@ -1003,6 +1003,14 @@ void MainForm::openProject(const QString &fileName)
     KMessageBox::error(this,"This project needs quill.drv, which is not installed.");
     return;
   }
+  if (TPRData.settings.fargo && !have_fargo) {
+    KMessageBox::error(this,"This project needs fargo.a, which is not installed.");
+    return;
+  }
+  if (TPRData.settings.flash_os && !have_flashos) {
+    KMessageBox::error(this,"This project needs flashos.a, which is not installed.");
+    return;
+  }
   clearProject();
   fileOpen_addList(hFilesListItem,&TPRData.h_files,&dir,TPRData.open_file);
   fileOpen_addList(cFilesListItem,&TPRData.c_files,&dir,TPRData.open_file);

+ 3 - 0
ktigcc/projectoptions.ui.h

@@ -33,6 +33,7 @@
 
 #include <qaccel.h>
 #include <kmessagebox.h>
+#include "ktigcc.h"
 #include "tpr.h"
 #include "programoptions.h"
 
@@ -43,6 +44,8 @@ ProgramOptions *programoptions;
 
 void ProjectOptions::init()
 {
+  if (!have_fargo) FargoProgram->hide();
+  if (!have_flashos) FlashOperatingSystem->hide();
   //Create the Program Options dialog
   programoptions=new ProgramOptions(this);
   //Toggle controls to match settings.