Skip to content

Commit 43b1e0e

Browse files
committed
use unzip location for installing integration
default to old location if missing zip
1 parent 1461c43 commit 43b1e0e

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Integrations
1616

1717
private const string FBX_EXPORT_SETTINGS_PATH = "Integrations/Autodesk/maya/scripts/unityFbxExportSettings.mel";
1818

19+
public static string INTEGRATION_FOLDER_PATH = Application.dataPath;
20+
1921
public class MayaException : System.Exception {
2022
public MayaException() { }
2123
public MayaException(string message) : base(message) { }
@@ -223,7 +225,7 @@ public static string GetModulePath(string version)
223225

224226
public static string GetModuleTemplatePath(string version)
225227
{
226-
string result = System.IO.Path.Combine(Application.dataPath, MODULE_TEMPLATE_PATH);
228+
string result = System.IO.Path.Combine(INTEGRATION_FOLDER_PATH, MODULE_TEMPLATE_PATH);
227229
if (!ModuleTemplateCompatibility.TryGetValue(version, out version)) {
228230
throw new MayaException("FbxExporters does not support Maya version " + version);
229231
}
@@ -508,8 +510,12 @@ class IntegrationsUI
508510

509511
public static void InstallMayaIntegration ()
510512
{
511-
DecompressIntegrationZipFile ();
512-
return;
513+
// decompress zip file if it exists, otherwise try using default location
514+
if (System.IO.File.Exists (GetIntegrationZipFullPath())) {
515+
DecompressIntegrationZipFile ();
516+
} else {
517+
Integrations.INTEGRATION_FOLDER_PATH = DefaultIntegrationSavePath;
518+
}
513519

514520
var mayaVersion = new Integrations.MayaVersion();
515521
if (!Integrations.InstallMaya(mayaVersion, verbose: true)) {
@@ -564,14 +570,25 @@ private static void DecompressIntegrationZipFile()
564570
);
565571

566572
if (result == 0) {
567-
DecompressZip (Application.dataPath + "/" + IntegrationZipPath, unzipFolder);
573+
DecompressZip (GetIntegrationZipFullPath(), unzipFolder);
568574
} else if (result == 2) {
569575
return;
570576
}
571577
} else {
572578
// unzip Integration folder
573-
DecompressZip (Application.dataPath + "/" + IntegrationZipPath, unzipFolder);
579+
DecompressZip (GetIntegrationZipFullPath(), unzipFolder);
574580
}
581+
582+
Integrations.INTEGRATION_FOLDER_PATH = unzipFolder;
583+
}
584+
585+
/// <summary>
586+
/// Gets the integration zip full path as an absolute Unity-style path.
587+
/// </summary>
588+
/// <returns>The integration zip full path.</returns>
589+
private static string GetIntegrationZipFullPath()
590+
{
591+
return Application.dataPath + "/" + IntegrationZipPath;
575592
}
576593

577594
/// <summary>

0 commit comments

Comments
 (0)