@@ -248,7 +248,6 @@ void UpdateRecentProjectsList()
248
248
var hklm = RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Registry64 ) ;
249
249
RegistryKey key = hklm . OpenSubKey ( @"SOFTWARE\Unity Technologies\Unity Editor 5.x" ) ;
250
250
251
- //Console.WriteLine(key);
252
251
if ( key == null )
253
252
{
254
253
SetStatus ( "No recent projects list founded" ) ;
@@ -261,9 +260,34 @@ void UpdateRecentProjectsList()
261
260
{
262
261
if ( valueName . IndexOf ( "RecentlyUsedProjectPaths-" ) == 0 )
263
262
{
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
+ }
267
291
268
292
string csprojFile = Path . Combine ( projectPath , projectName + ".csproj" ) ;
269
293
@@ -314,7 +338,6 @@ void LaunchProject(string projectPath, string version, bool openProject = true)
314
338
315
339
// check for crashed backup scene first
316
340
var cancelLaunch = CheckCrashBackupScene ( projectPath ) ;
317
- Console . WriteLine ( cancelLaunch ) ;
318
341
if ( cancelLaunch == true )
319
342
{
320
343
return ;
@@ -1015,5 +1038,7 @@ void DisplayUpgradeDialog(string currentVersion, string projectPath, bool launch
1015
1038
}
1016
1039
upgradeDialog . Close ( ) ;
1017
1040
}
1041
+
1042
+
1018
1043
}
1019
1044
}
0 commit comments