Skip to content

Commit f978340

Browse files
committed
fix so install doesn't happen on cancel
1 parent 9c7ba95 commit f978340

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,11 @@ public static void InstallMayaIntegration ()
518518
{
519519
// decompress zip file if it exists, otherwise try using default location
520520
if (System.IO.File.Exists (GetIntegrationZipFullPath())) {
521-
DecompressIntegrationZipFile ();
521+
var result = DecompressIntegrationZipFile ();
522+
if (!result) {
523+
// could not find integration
524+
return;
525+
}
522526
} else {
523527
Integrations.INTEGRATION_FOLDER_PATH = DefaultIntegrationSavePath;
524528
}
@@ -541,11 +545,14 @@ public static void InstallMayaIntegration ()
541545
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
542546
}
543547

544-
private static void DecompressIntegrationZipFile()
548+
private static bool DecompressIntegrationZipFile()
545549
{
546550
// prompt user to enter location to unzip file
547551
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+
}
549556

550557
// check that this is a valid location to unzip the file
551558
if (!DirectoryHasWritePermission (unzipFolder)) {
@@ -559,7 +566,7 @@ private static void DecompressIntegrationZipFile()
559566
if (result) {
560567
InstallMayaIntegration ();
561568
} else {
562-
return;
569+
return false;
563570
}
564571
}
565572

@@ -578,14 +585,16 @@ private static void DecompressIntegrationZipFile()
578585
if (result == 0) {
579586
DecompressZip (GetIntegrationZipFullPath(), unzipFolder);
580587
} else if (result == 2) {
581-
return;
588+
return false;
582589
}
583590
} else {
584591
// unzip Integration folder
585592
DecompressZip (GetIntegrationZipFullPath(), unzipFolder);
586593
}
587594

588595
Integrations.INTEGRATION_FOLDER_PATH = unzipFolder;
596+
597+
return true;
589598
}
590599

591600
/// <summary>
@@ -616,10 +625,7 @@ public static bool FolderAlreadyUnzippedAtPath(string path)
616625
/// <param name="path">Path.</param>
617626
public static bool DirectoryHasWritePermission(string path)
618627
{
619-
if (!System.IO.Directory.Exists (path)) {
620-
return false;
621-
}
622-
return true;
628+
return System.IO.Directory.Exists (path);
623629
}
624630

625631
public static void DecompressZip(string zipPath, string destPath){

0 commit comments

Comments
 (0)