ide/IDESettings: Fixed issues with fresh install
authorJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 13:56:09 +0000 (09:56 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sat, 22 Oct 2016 14:02:38 +0000 (10:02 -0400)
- Fixed crash on first save of recentProjects (null array)
- Fixed compilerConfigs not being carried over from system wide settings

ide/src/IDESettings.ec

index a1ea2b0..ab38ac5 100644 (file)
@@ -530,6 +530,7 @@ class IDESettingsContainer : GlobalSettings
             int c;
             bool locked;
             for(c = 0; c < 10 && !(locked = f.Lock(shared, 0, 0, false)); c++) ecere::sys::Sleep(0.01);
+            if(!recentProjects) recentProjects = { };
             recentProjects.read(this);
             f.Unlock(0,0,true);
             delete f;
@@ -653,7 +654,15 @@ private:
       if(result == fileNotFound || (settingsFilePath && isGlobalPath))
       {
          bool retryNewConfig = settingsFilePath && isGlobalPath;
-         oldConfig = true;
+
+         if(retryNewConfig)
+         {
+            // Need to load the data outside of main config file first
+            data.compilerConfigs.read(this);
+            data.recentFiles.read(this);
+            data.recentProjects.read(this);
+         }
+         oldConfig = true; // WARNING: This is being used with two meanings: Old format and loaded from system-wide settings
          useNewConfigurationFiles = false;
          if(retryNewConfig)
          {