@@ -248,7 +248,6 @@ void UpdateRecentProjectsList()
248248 var hklm = RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Registry64 ) ;
249249 RegistryKey key = hklm . OpenSubKey ( @"SOFTWARE\Unity Technologies\Unity Editor 5.x" ) ;
250250
251- //Console.WriteLine(key);
252251 if ( key == null )
253252 {
254253 SetStatus ( "No recent projects list founded" ) ;
@@ -261,9 +260,34 @@ void UpdateRecentProjectsList()
261260 {
262261 if ( valueName . IndexOf ( "RecentlyUsedProjectPaths-" ) == 0 )
263262 {
264- byte [ ] projectPathBytes = ( byte [ ] ) key . GetValue ( valueName ) ;
265- string projectPath = Encoding . Default . GetString ( projectPathBytes , 0 , projectPathBytes . Length - 1 ) ;
266- string projectName = projectPath . Substring ( projectPath . LastIndexOf ( "/" ) + 1 ) ;
263+ string projectPath = "" ;
264+ // check if binary or not
265+ var valueKind = key . GetValueKind ( valueName ) ;
266+ if ( valueKind == RegistryValueKind . Binary )
267+ {
268+ byte [ ] projectPathBytes = ( byte [ ] ) key . GetValue ( valueName ) ;
269+ projectPath = Encoding . Default . GetString ( projectPathBytes , 0 , projectPathBytes . Length - 1 ) ;
270+ }
271+ else // should be string then
272+ {
273+ projectPath = ( string ) key . GetValue ( valueName ) ;
274+ }
275+
276+ string projectName = "" ;
277+
278+ // get project name from full path
279+ if ( projectPath . IndexOf ( Path . PathSeparator ) > - 1 )
280+ {
281+ projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . PathSeparator ) + 1 ) ;
282+ }
283+ else if ( projectPath . IndexOf ( Path . AltDirectorySeparatorChar ) > - 1 )
284+ {
285+ projectName = projectPath . Substring ( projectPath . LastIndexOf ( Path . AltDirectorySeparatorChar ) + 1 ) ;
286+ }
287+ else // no path separator founded
288+ {
289+ projectName = projectPath ;
290+ }
267291
268292 string csprojFile = Path . Combine ( projectPath , projectName + ".csproj" ) ;
269293
@@ -314,7 +338,6 @@ void LaunchProject(string projectPath, string version, bool openProject = true)
314338
315339 // check for crashed backup scene first
316340 var cancelLaunch = CheckCrashBackupScene ( projectPath ) ;
317- Console . WriteLine ( cancelLaunch ) ;
318341 if ( cancelLaunch == true )
319342 {
320343 return ;
@@ -1015,5 +1038,7 @@ void DisplayUpgradeDialog(string currentVersion, string projectPath, bool launch
10151038 }
10161039 upgradeDialog . Close ( ) ;
10171040 }
1041+
1042+
10181043 }
10191044}
0 commit comments