@@ -53,14 +53,24 @@ private void Form1_Load(object sender, EventArgs e)
5353 return ;
5454 }
5555
56- // check if received any arguments (that means, should try open the project)
56+ // test: -projectPath "D:\download\Swarm-master(1)\Swarm-master"
57+
58+ // check if received -projectPath argument (that means, should try open the project)
5759 string [ ] args = Environment . GetCommandLineArgs ( ) ;
58- if ( args != null && args . Length > 1 )
60+ if ( args != null && args . Length > 2 )
5961 {
60- var pathArg = args [ 1 ] ;
61- Console . WriteLine ( "\n PATH: " + pathArg ) ;
62- Console . WriteLine ( "" ) ;
63- LaunchProject ( pathArg ) ;
62+ var commandArg = args [ 1 ] ;
63+ if ( commandArg == "-projectPath" )
64+ {
65+ var pathArg = args [ 2 ] ;
66+ Console . WriteLine ( "\n PATH: " + pathArg ) ;
67+ LaunchProject ( pathArg ) ;
68+ }
69+ else
70+ {
71+ Console . WriteLine ( "Invalid arguments:" + args [ 1 ] ) ;
72+ }
73+
6474 }
6575
6676 // this could be delayed, if it affects unity starting?
@@ -153,7 +163,7 @@ bool ScanUnityInstallations()
153163 if ( File . Exists ( uninstallExe ) == true )
154164 {
155165 var unityVersion = GetUnityVersion ( uninstallExe ) . Replace ( "Unity" , "" ) . Trim ( ) ;
156- if ( unityList . ContainsKey ( unityVersion ) == false )
166+ if ( unityList . ContainsKey ( unityVersion ) == false )
157167 {
158168 unityList . Add ( unityVersion , unityExe ) ;
159169 }
@@ -211,7 +221,7 @@ void UpdateRecentProjectsList()
211221 string csprojFile = Path . Combine ( projectPath , projectName + ".csproj" ) ;
212222
213223 // editor only project
214- if ( File . Exists ( csprojFile ) == false )
224+ if ( File . Exists ( csprojFile ) == false )
215225 {
216226 csprojFile = Path . Combine ( projectPath , projectName + ".Editor.csproj" ) ;
217227 }
@@ -223,7 +233,7 @@ void UpdateRecentProjectsList()
223233
224234 gridRecent . Rows . Add ( projectName , projectVersion , projectPath , lastUpdated ) ;
225235 //gridRecent.Rows[gridRecent.Rows.Count-1].Cells[1].Style.BackColor = HaveExactVersionInstalled(projectVersion) ?Color.Green:Color.Red;
226- gridRecent . Rows [ gridRecent . Rows . Count - 1 ] . Cells [ 1 ] . Style . ForeColor = HaveExactVersionInstalled ( projectVersion ) ? Color . Green : Color . Red ;
236+ gridRecent . Rows [ gridRecent . Rows . Count - 1 ] . Cells [ 1 ] . Style . ForeColor = HaveExactVersionInstalled ( projectVersion ) ? Color . Green : Color . Red ;
227237 }
228238 }
229239 }
@@ -420,7 +430,7 @@ private void btn_openFolder_Click(object sender, EventArgs e)
420430
421431 void LaunchExplorer ( string folder )
422432 {
423- if ( Directory . Exists ( folder ) == true )
433+ if ( Directory . Exists ( folder ) == true )
424434 {
425435 Process . Start ( folder ) ;
426436 }
0 commit comments