|
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 first 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 { // Linux assumed return new File(unityHome, "Editor/Unity"); }
}
You always end up getting the Linux path appended unless the Windows check is true.
Simply moving the OS_NAME initializer up to the first line in Functions2 will fix the problem (for Mac users)
|