@@ -191,7 +191,7 @@ public static void AddProjectToHistory(string projectPath)
191191 {
192192 // fix backslashes
193193 projectPath = projectPath . Replace ( '\\ ' , '/' ) ;
194-
194+
195195 if ( Properties . Settings . Default . projectPaths . Contains ( projectPath ) == false )
196196 {
197197 // TODO do we need to add as first?
@@ -767,6 +767,18 @@ public static void HandleDataGridScrollKeys(object sender, KeyEventArgs e)
767767 */
768768 }
769769
770+ // NOTE this doesnt modify the 2nd line in ProjectVersion.txt
771+ static void SaveProjectVersion ( Project proj )
772+ {
773+ var settingsPath = Path . Combine ( proj . Path , "ProjectSettings" , "ProjectVersion.txt" ) ;
774+ if ( File . Exists ( settingsPath ) )
775+ {
776+ var versionRows = File . ReadAllLines ( settingsPath ) ;
777+ versionRows [ 0 ] = "m_EditorVersion: " + proj . Version ;
778+ File . WriteAllLines ( settingsPath , versionRows ) ;
779+ }
780+ }
781+
770782 public static void DisplayUpgradeDialog ( Project proj , MainWindow owner , bool useInitScript = false )
771783 {
772784 UpgradeWindow modalWindow = new UpgradeWindow ( proj . Version , proj . Path , proj . Arguments ) ;
@@ -786,9 +798,12 @@ public static void DisplayUpgradeDialog(Project proj, MainWindow owner, bool use
786798 // get selected version to upgrade for
787799 Console . WriteLine ( "Upgrade to " + upgradeToVersion ) ;
788800
789- // inject new version for this item
801+ // inject new version for this item, TODO inject version to ProjectSettings file, so then no alert from unity wrong version dialog
790802 proj . Version = upgradeToVersion ;
791- var proc = LaunchProject ( proj , null , false ) ;
803+ SaveProjectVersion ( proj ) ;
804+ var proc = LaunchProject ( proj , dataGridRef : null , useInitScript : false , upgrade : true ) ;
805+
806+ // TODO update datagrid row for new version
792807 }
793808 else
794809 {
0 commit comments