@@ -32,14 +32,16 @@ public MayaVersion(string desiredVersion = "") {
32
32
// If the location is given by the environment, use it.
33
33
Location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
34
34
if ( ! string . IsNullOrEmpty ( Location ) ) {
35
+ Location = Location . TrimEnd ( '/' ) ;
36
+ Debug . Log ( "Using maya set by MAYA_LOCATION: " + Location ) ;
35
37
return ;
36
38
}
37
39
38
40
// List that directory and find the right version:
39
41
// either the newest version, or the exact version we wanted.
40
42
string mayaRoot = "" ;
41
43
string bestVersion = "" ;
42
- var adskRoot = new System . IO . DirectoryInfo ( GetAdskRoot ( ) ) ;
44
+ var adskRoot = new System . IO . DirectoryInfo ( AdskRoot ) ;
43
45
foreach ( var productDir in adskRoot . GetDirectories ( ) ) {
44
46
var product = productDir . Name ;
45
47
@@ -71,22 +73,27 @@ public MayaVersion(string desiredVersion = "") {
71
73
"Unable to find any version of maya. Set MAYA_LOCATION." ) ) ;
72
74
}
73
75
74
- Location = GetAdskRoot ( ) + "/" + mayaRoot ;
76
+ Location = AdskRoot + "/" + mayaRoot ;
77
+ if ( string . IsNullOrEmpty ( desiredVersion ) ) {
78
+ Debug . Log ( "Using latest version of maya found in: " + Location ) ;
79
+ } else {
80
+ Debug . Log ( string . Format ( "Using maya {0} found in: {1}" , desiredVersion , Location ) ) ;
81
+ }
75
82
}
76
83
77
84
/// <summary>
78
85
/// The path where all the different versions of Maya are installed
79
86
/// by default. Depends on the platform.
80
87
/// </summary>
81
- public static string GetAdskRoot ( ) {
88
+ public const string AdskRoot =
82
89
#if UNITY_EDITOR_OSX
83
- return "/Applications/Autodesk" ;
90
+ "/Applications/Autodesk"
84
91
#elif UNITY_EDITOR_LINUX
85
- return "/usr/autodesk" ;
92
+ "/usr/autodesk"
86
93
#else // WINDOWS
87
- return "C:/Program Files/Autodesk" ;
94
+ "C:/Program Files/Autodesk"
88
95
#endif
89
- }
96
+ ;
90
97
91
98
/// <summary>
92
99
/// The value that you might set MAYA_LOCATION to if you wanted to
@@ -100,9 +107,13 @@ public static string GetAdskRoot() {
100
107
public string MayaExe {
101
108
get {
102
109
#if UNITY_EDITOR_OSX
103
- // MAYA_LOCATION on mac might be the app bundle itself, or
104
- // the directory in which the app bundle is stored.
105
- if ( Location . EndsWith ( ".app" ) ) {
110
+ // MAYA_LOCATION on mac is set by Autodesk to be the
111
+ // Contents directory. But let's make it easier on people
112
+ // and allow just having it be the app bundle or a
113
+ // directory that holds the app bundle.
114
+ if ( Location . EndsWith ( ".app/Contents" ) ) {
115
+ return Location + "/MacOS/Maya" ;
116
+ } else if ( Location . EndsWith ( ".app" ) ) {
106
117
return Location + "/Contents/MacOS/Maya" ;
107
118
} else {
108
119
return Location + "/Maya.app/Contents/MacOS/Maya" ;
0 commit comments