cleaned all trailing white space from source files.
[sdk] / installer / src / installer.ec
index 1a83d2e..02d8ad8 100644 (file)
@@ -116,11 +116,11 @@ void ExtractFileFromArchive(ProgressBar progressBar, char * path, char * outputF
 
             FileGetSize(path, &dataSize);
             GetLastDirectory(outputFile, fileName);
-            
+
             ((GuiApplication)__thisModule).SignalEvent();
             //((GuiApplication)__thisModule).ProcessInput();
             //((GuiApplication)__thisModule).UpdateDisplay();
-            
+
             for(c = 0; c<dataSize && !abortInstall; c += BUFFERSIZE)
             {
                uint size = (dataSize > c + BUFFERSIZE) ? BUFFERSIZE : (dataSize - c);
@@ -170,12 +170,12 @@ struct Component
    char installPath[MAX_LOCATION];
    DataRow row;
 
-   void GetFullPath(char * path)
+   void GetFullPath(char * path, bool is32bit)
    {
       if(this != null && parent)
-         parent->GetFullPath(path);
+         parent->GetFullPath(path, is32bit || (arch == bits32 && osIS64bit));
       else
-         strcpy(path, installDir);
+         strcpy(path, (is32bit || (arch == bits32 && osIS64bit)) ? installDir32 : installDir);
 
       if(this != null)
          PathCat(path, installPath);
@@ -218,7 +218,7 @@ struct Component
             if(requiredSize)
             {
                uint p = installProgress.progressBar.progress;
-               ExtractFileFromArchive(installProgress.progressBar, source, path); 
+               ExtractFileFromArchive(installProgress.progressBar, source, path);
             }
          }
          if(subComponents)
@@ -272,7 +272,7 @@ Component coreSDK[CoreSDKID] =
    { "GNU C Compiler",  "tdm/gcc/core",   "tdm", null, true, true, minGWIncluded, none },
    { "GNU Debugger",    "tdm/gdb",        "tdm", null, true, true, minGWIncluded, bits64 },
    { "GNU Debugger",    "tdm/gdb32",      "tdm", null, true, true, minGWIncluded, bits32 },
-   { "MinGW Runtime",   "tdm/mingwrt",    "tdm", null, true, true, minGWIncluded, none },
+   { "MinGW-w64 Runtime",   "tdm/mingwrt",    "tdm", null, true, true, minGWIncluded, none },
    { "Binary Utils",    "tdm/binutils",   "tdm", null, true, true, minGWIncluded, none },
    { "GNU Make",        "tdm/make",       "tdm", null, true, true, minGWIncluded, none },
    { null }
@@ -280,7 +280,7 @@ Component coreSDK[CoreSDKID] =
 
 public enum AdditionalID
 {
-   eda, eda32, vanilla, vanilla32, extras, upx, gnurx, gnurx32, /*pthreads, */cpp, /*w32api, */gcci18n, gdbi18n, makei18n, binutilsi18n, none
+   eda, eda32, vanilla, vanilla32, extras, upx, gnurx, gnurx32, /*pthreads, */cpp, /*w32api, gcci18n, gdbi18n, makei18n, binutilsi18n, */none
 };
 
 Component additional[AdditionalID] =
@@ -296,10 +296,11 @@ Component additional[AdditionalID] =
 //   { "pthreads",        "tdm/pthreads",                   "mingw",    null, false, true, minGWIncluded, none },
    { "C++ Compiler",    "tdm/gcc/c++",                   "tdm",    null, false, true, minGWIncluded, none },
 //   { "Win32 APIs",      "mingw/w32api",                  "mingw",    null, false, true, minGWIncluded, none },
-   { "GCC I18n",        "mingw/locale/gcc",              "tdm",    null, false, false, minGWIncluded, none },
+/*   { "GCC I18n",        "mingw/locale/gcc",              "tdm",    null, false, false, minGWIncluded, none },
    { "GDB I18n",        "mingw/locale/gdb",              "tdm",    null, false, false, minGWIncluded, none },
    { "Make I18n",       "mingw/locale/make",             "tdm",    null, false, false, minGWIncluded, none },
    { "Binutils I18n",   "mingw/locale/binutils",         "tdm",    null, false, false, minGWIncluded, none },
+*/
    { null }
 };
 
@@ -434,12 +435,12 @@ class Installer : Window
    Button browse
    {
       master = this, autoCreate = false, inactive = true, text = "...";
-      
+
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
          DataRow row = componentsBox.currentRow;
          Component * component = ((CheckItem *)row.GetData(componentField))->data;
-         component->GetFullPath(fileDialog.filePath);
+         component->GetFullPath(fileDialog.filePath, false);
          StripLastDirectory(fileDialog.filePath, fileDialog.currentDirectory);
 
          if(fileDialog.Modal() == ok)
@@ -455,7 +456,7 @@ class Installer : Window
    CheckListBox componentsBox
    {
       this, size = { 460, 112 }, position = { 160, 160 }, hasHeader = true;
-      fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true, 
+      fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
       noDragging = true;
       rowHeight = 18;
       selectionColor = { 145, 150, 140 };
@@ -476,7 +477,7 @@ class Installer : Window
          char path[MAX_LOCATION], relative[MAX_LOCATION] = "", * newPath;
          char fullPath[MAX_LOCATION];
 
-         component->parent->GetFullPath(path);
+         component->parent->GetFullPath(path, false);
          strcpy(fullPath, path);
 
          newPath = row.GetData(locationField);
@@ -533,7 +534,7 @@ class Installer : Window
          component->requiredSize = 0;
          if(component->selected)
          {
-            component->requiredSize += component->size; 
+            component->requiredSize += component->size;
             if(component->subComponents)
                for(c = 0; component->subComponents[c].name; c++)
                   component->requiredSize += component->subComponents[c].requiredSize;
@@ -545,7 +546,7 @@ class Installer : Window
          }
          else
             row.UnsetData(reqField);
-         if(!component->parent) 
+         if(!component->parent)
          {
             totalSize += component->requiredSize;
             {
@@ -574,7 +575,7 @@ class Installer : Window
    CheckListBox optionsBox
    {
       this, size = { 460, 94 }, position = { 160, 284 };
-      fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true, 
+      fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true,
       noDragging = true;
       rowHeight = 18;
       opacity = 0;
@@ -661,7 +662,7 @@ class Installer : Window
    };
    EditBox label7
    {
-      this, opacity = 0, borderStyle = none, inactive = true, size = { 136, 53 }, position = { 14, 280 }, noSelect = true, 
+      this, opacity = 0, borderStyle = none, inactive = true, size = { 136, 53 }, position = { 14, 280 }, noSelect = true,
       multiLine = true,
       contents = $"Select icons to install, file\n"
       "associations, and system\n"
@@ -755,7 +756,7 @@ class Installer : Window
       if(component.defInstallPath)
          PathCat(path, component.defInstallPath);
       component.parent = parent;
-         
+
       row.SetData(null, CheckItem { component.name, component, (component.arch == bits32 && osIS64bit) } );
 
       if(component.defInstallPath)
@@ -767,13 +768,13 @@ class Installer : Window
 
       if(component.mandatory)
       {
-         if(component.arch != bits32 || !osIS64bit || component == &coreSDK[gdb32])
+         if(component.arch != bits32 || !osIS64bit) // || component == &coreSDK[gdb32])
             componentsBox.SetDisabled(row, true);
-         else
-            component.selected = false;
+         /*else
+            component.selected = false;*/
       }
       else if(component.arch == bits32 && osIS64bit)
-         component.selected = false;
+         ; //component.selected = false;
 
       componentsBox.SetCheck(row, component.selected);
 
@@ -806,7 +807,7 @@ class Installer : Window
 
       while(!FileExists(path) && path[0])
          StripLastDirectory(path, path);
-      
+
       if(path[0])
          GetFreeSpace(path, &avSize);
       else
@@ -842,7 +843,7 @@ class Installer : Window
       GetEnvironment("APPDATA", appData, sizeof(appData));
       GetEnvironment("HOMEDRIVE", homeDrive, sizeof(homeDrive));
       GetEnvironment("windir", winDir, sizeof(winDir));
-      
+
       componentsBox.AddField(componentField);
       componentsBox.AddField(locationField);
       componentsBox.AddField(reqField);
@@ -856,16 +857,18 @@ class Installer : Window
          if(x86)
          {
             strcpy(installDir32, programFilesDir);
+            PathCat(installDir32, "Ecere SDK");
             osIS64bit = true;
 
             *x86 = 0;
-            PathCat(installDir, "Ecere SDK");
             strcpy(installDir, programFilesDir);
+            PathCat(installDir, "Ecere SDK");
          }
          else
          {
-            PathCat(installDir, "Ecere SDK");
             strcpy(installDir, programFilesDir);
+            PathCat(installDir, "Ecere SDK");
+            strcpy(installDir32, installDir);
          }
       }
       else if(homeDrive && homeDrive[0])
@@ -880,7 +883,7 @@ class Installer : Window
       }
       else
          strcpy(installDir, "C:\\Ecere SDK");
-      
+
       if(appData && appData[0])
       {
          static char defSamplesPath[MAX_LOCATION];
@@ -893,7 +896,7 @@ class Installer : Window
          PathCat(defExtrasPath, "Ecere SDK\\extras");
          additional[extras].defInstallPath = defExtrasPath;
       }
-         
+
       destBox.path = installDir;
 
       {
@@ -1033,7 +1036,7 @@ static void AddPath(char * sysPaths[200], int sysCount, char * paths[200], int *
    if(!found)
    {
       char * start;
-      if(*count) 
+      if(*count)
       {
          strcat(userPath, ";");
          start = paths[(*count)-1] + strlen(paths[(*count)-1])+1;
@@ -1066,7 +1069,7 @@ void ModifyPath(char * systemPath, char * userPath)
          bool found = false;
          char path[MAX_LOCATION];
          if(!coreSDK[c].selected) continue;
-         coreSDK[c].GetFullPath(path);
+         coreSDK[c].GetFullPath(path, false);
          if(c != ide && c != runtime && c != ec &&
             c != ide32 && c != runtime32 && c != ec32)
          {
@@ -1089,7 +1092,7 @@ void ModifyPath(char * systemPath, char * userPath)
          if(!additional[c].selected || c == vanilla || c == vanilla32 || c == extras) continue;
          if((c != eda && c != eda32 && c != upx) && (!pathOptions[PathOptions::AddMinGWPaths].available || !pathOptions[PathOptions::AddMinGWPaths].selected))
             continue;
-         additional[c].GetFullPath(path);
+         additional[c].GetFullPath(path, false);
          if(c != eda && c != eda32 && c != upx)
             PathCat(path, "bin");
          AddPath(sysPaths, sysCount, paths, &count, oldPath, userPath, path);
@@ -1122,7 +1125,7 @@ void AssociateExtension(char * extension, char * description, char *name, char *
 
    sprintf(keyName, "%s\\shell\\%s\\command", name, action);
    RegCreateKeyEx(HKEY_CLASSES_ROOT, keyName, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &key, &status);
-   
+
    sprintf(keyName, path);
    strcat(keyName, " \"%L\"");
    {
@@ -1184,14 +1187,14 @@ class InstallThread : Thread
                   char path[MAX_LOCATION];
                   if(!coreSDK[c].selected || !coreSDK[c].available) continue;
 
-                  coreSDK[c].GetFullPath(path);
+                  coreSDK[c].GetFullPath(path, false);
                   if(c != ide && c != runtime && c != ec &&
                      c != ide32 && c != runtime32 && c != ec32)
                      PathCat(path, "bin");
                   MakeSlashPath(path);
                   if((c == ide && osIS64bit) || (c == ide32 && !osIS64bit))
                   {
-                     coreSDK[c].GetFullPath(idePath);
+                     coreSDK[c].GetFullPath(idePath, false);
                      PathCat(idePath, "ide.exe");
                   }
 
@@ -1209,7 +1212,7 @@ class InstallThread : Thread
                {
                   char path[MAX_LOCATION];
                   if(c == extras || !additional[c].selected || !additional[c].available) continue;
-                  additional[c].GetFullPath(path);
+                  additional[c].GetFullPath(path, false);
                   if(c != upx && c != eda && c != vanilla && c != eda32 && c != vanilla32)
                      PathCat(path, "bin");
                   MakeSlashPath(path);
@@ -1231,9 +1234,9 @@ class InstallThread : Thread
             char path[MAX_LOCATION] = "";
 
             if(components[samples].selected)
-               components[samples].GetFullPath(path);
+               components[samples].GetFullPath(path, false);
             else
-               components[coreSDK].GetFullPath(path);
+               components[coreSDK].GetFullPath(path, false);
 
             if(!settings.ideProjectFileDialogLocation[0])
                settings.ideProjectFileDialogLocation = path;
@@ -1242,7 +1245,7 @@ class InstallThread : Thread
 
             if(documentation[apiRef].selected)
             {
-               documentation[apiRef].GetFullPath(path);
+               documentation[apiRef].GetFullPath(path, false);
                if(!settings.docDir[0])
                   settings.docDir = path;
             }
@@ -1279,7 +1282,7 @@ class InstallThread : Thread
          }
 
          // Add paths
-         if(pathOptions[PathOptions::AddECEREPaths].selected 
+         if(pathOptions[PathOptions::AddECEREPaths].selected
 #ifndef NOMINGW
             || pathOptions[PathOptions::AddMinGWPaths].selected
 #endif
@@ -1299,14 +1302,14 @@ class InstallThread : Thread
             installProgress.installing.text = "Registering paths...";
             ((GuiApplication)__thisModule).Unlock();
             ((GuiApplication)__thisModule).SignalEvent();
-                        
+
             if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", 0, KEY_QUERY_VALUE, &systemKey) == ERROR_SUCCESS)
             {
                size = sizeof(wSystemPath);
                RegQueryValueExW(systemKey, L"path", null, null, (byte *)wSystemPath, &size);
                UTF16toUTF8Buffer(wSystemPath, systemPath, sizeof(systemPath));
             }
-            
+
             RegCreateKeyEx(HKEY_CURRENT_USER, "Environment", 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, null, &userKey, &status);
             if(status == REG_OPENED_EXISTING_KEY)
             {
@@ -1366,7 +1369,7 @@ class InstallThread : Thread
                if(components[samples].selected)
                {
                   char samplesPath[MAX_LOCATION] = "";
-                  components[samples].GetFullPath(samplesPath);
+                  components[samples].GetFullPath(samplesPath, false);
 
                   strcpy(destPath, startMenuPath);
                   PathCat(destPath, "Ecere SDK\\Sample Projects.lnk");
@@ -1375,12 +1378,12 @@ class InstallThread : Thread
                if(components[documentation].selected && documentation[ecereBook].selected)
                {
                   char docPath[MAX_LOCATION] = "";
-                  documentation[ecereBook].GetFullPath(docPath);
+                  documentation[ecereBook].GetFullPath(docPath, false);
                   PathCat(docPath, "Ecere Tao of Programming [work in progress].pdf");
 
                   {
                      char tao[MAX_LOCATION] ;
-                     documentation[ecereBook].GetFullPath(tao);
+                     documentation[ecereBook].GetFullPath(tao, false);
                      PathCat(tao, "tao.pdf");
                      RenameFile(tao, docPath);
                   }
@@ -1460,7 +1463,7 @@ class InstallThread : Thread
             installProgress.installing.text = $"Resgistering File Types...";
             ((GuiApplication)__thisModule).Unlock();
             ((GuiApplication)__thisModule).SignalEvent();
-            
+
             if(associateOptions[AssociateOptions::AssociateEPJ].selected)
             {
                AssociateExtension(".epj", "Ecere IDE Project", "epj_file", "Open", idePath);