I did a little digging in the code - the problem is in Functions2 - the OS_NAME static is initialized too late.
When everything is static order is important.
class Functions2 {
public static boolean isMac() {
return IS_OS_MAC;
}
public static boolean isLinux() {
return IS_OS_LINUX;
}
private static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
private static final boolean IS_OS_MAC = getOSMatchesName("Mac");
private static final String OS_NAME = System.getProperty("os.name");
////
The IS_OS_LINUX and IS_OS_MAC lines get initialized by calling getOSMatchesName
getOSMatchesName in turn calls isOSNameMatch(OS_NAME, osNamePrefix);
But at this point OS_NAME has not yet been initialized so all the checks fail because OS_NAME is null.
So when org.jenkinsci.plugins.unity3d.Unity3dInstallation#checkUnity3dExecutablePath calls org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#check which calls org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#getExeFile that does this check
private static File getExeFile(File unityHome) {
if (Functions.isWindows()) {
return new File(unityHome, "Editor/Unity.exe");
} else if (Functions2.isMac()) {
return new File(unityHome, "Contents/MacOS/Unity");
} else { return new File(unityHome, "Editor/Unity");
}
}
You always end up getting the Linux path appended unless the Windows check is true.
Suggested Fix:
Move the OS_NAME initializer up to the first line in Functions2 so OS_NAME is the first value initialized or drop the field completely and change
private static boolean getOSMatchesName(String osNamePrefix) {
return isOSNameMatch(OS_NAME, osNamePrefix);
}
Into this:
private static boolean getOSMatchesName(String osNamePrefix) {
return isOSNameMatch(System.getProperty("os.name"), osNamePrefix);
}
Both solutions should fix the issue for Mac users
Same here - unable to install and configure 1.2 due to this
The help text is correct for OSx, but the failure indicates that something is assymmetric between the check and the help.
https://www.dropbox.com/s/22ckebttczejxg8/Screenshot%202015-09-11%2014.04.06.png?dl=0