@@ -518,7 +518,11 @@ public static void InstallMayaIntegration ()
518
518
{
519
519
// decompress zip file if it exists, otherwise try using default location
520
520
if ( System . IO . File . Exists ( GetIntegrationZipFullPath ( ) ) ) {
521
- DecompressIntegrationZipFile ( ) ;
521
+ var result = DecompressIntegrationZipFile ( ) ;
522
+ if ( ! result ) {
523
+ // could not find integration
524
+ return ;
525
+ }
522
526
} else {
523
527
Integrations . INTEGRATION_FOLDER_PATH = DefaultIntegrationSavePath ;
524
528
}
@@ -541,11 +545,14 @@ public static void InstallMayaIntegration ()
541
545
UnityEditor . EditorUtility . DisplayDialog ( title , message , "Ok" ) ;
542
546
}
543
547
544
- private static void DecompressIntegrationZipFile ( )
548
+ private static bool DecompressIntegrationZipFile ( )
545
549
{
546
550
// prompt user to enter location to unzip file
547
551
var unzipFolder = EditorUtility . OpenFolderPanel ( "Select Location to Save Maya Integration" , LastIntegrationSavePath , "" ) ;
548
- Debug . Log ( unzipFolder ) ;
552
+ if ( string . IsNullOrEmpty ( unzipFolder ) ) {
553
+ // user has cancelled, do nothing
554
+ return false ;
555
+ }
549
556
550
557
// check that this is a valid location to unzip the file
551
558
if ( ! DirectoryHasWritePermission ( unzipFolder ) ) {
@@ -559,7 +566,7 @@ private static void DecompressIntegrationZipFile()
559
566
if ( result ) {
560
567
InstallMayaIntegration ( ) ;
561
568
} else {
562
- return ;
569
+ return false ;
563
570
}
564
571
}
565
572
@@ -578,14 +585,16 @@ private static void DecompressIntegrationZipFile()
578
585
if ( result == 0 ) {
579
586
DecompressZip ( GetIntegrationZipFullPath ( ) , unzipFolder ) ;
580
587
} else if ( result == 2 ) {
581
- return ;
588
+ return false ;
582
589
}
583
590
} else {
584
591
// unzip Integration folder
585
592
DecompressZip ( GetIntegrationZipFullPath ( ) , unzipFolder ) ;
586
593
}
587
594
588
595
Integrations . INTEGRATION_FOLDER_PATH = unzipFolder ;
596
+
597
+ return true ;
589
598
}
590
599
591
600
/// <summary>
@@ -616,10 +625,7 @@ public static bool FolderAlreadyUnzippedAtPath(string path)
616
625
/// <param name="path">Path.</param>
617
626
public static bool DirectoryHasWritePermission ( string path )
618
627
{
619
- if ( ! System . IO . Directory . Exists ( path ) ) {
620
- return false ;
621
- }
622
- return true ;
628
+ return System . IO . Directory . Exists ( path ) ;
623
629
}
624
630
625
631
public static void DecompressZip ( string zipPath , string destPath ) {
0 commit comments