Skip to content

Instantly share code, notes, and snippets.

@c4pt0r
Created June 3, 2014 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4pt0r/da39cd0c4cad65fa87b4 to your computer and use it in GitHub Desktop.
Save c4pt0r/da39cd0c4cad65fa87b4 to your computer and use it in GitHub Desktop.
jdk mac os pkg
// Check is current MAC OS X version less than supportedVersion
function checkForMacOSX(supportedVersion) {
try {
// Get current ProductVersion
var tProductVersion = system.version.ProductVersion;
// Get current ProductName
var tProductName = system.version.ProductName;
// Check if current version is less than supportedVersion, if yes Set the result type to Fatal, and give correct message to user
if(tProductVersion < supportedVersion)
{
// Set result values
var osCheckTitle = system.localizedStringWithFormat('OSCHECK_TITLE');
osCheckTitle = osCheckTitle.replace("%1$@", tProductName);
osCheckTitle = osCheckTitle.replace("%2$@", supportedVersion);
var osCheckMessage = system.localizedStringWithFormat('OSCHECK_MESSAGE');
osCheckMessage = osCheckMessage.replace("%1$@", tProductName);
osCheckMessage = osCheckMessage.replace("%2$@", tProductVersion);
osCheckMessage = osCheckMessage.replace("%3$@", supportedVersion);
my.result.title = osCheckTitle;
my.result.message = osCheckMessage;
my.result.type = 'Fatal';
}
} catch (e) {
// an exception just occurred
return (false);
}
// return true
return (true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment