本文整理汇总了Java中com.izforge.izpack.util.OsVersion.IS_WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java OsVersion.IS_WINDOWS属性的具体用法?Java OsVersion.IS_WINDOWS怎么用?Java OsVersion.IS_WINDOWS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.izforge.izpack.util.OsVersion
的用法示例。
在下文中一共展示了OsVersion.IS_WINDOWS属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultPath
String getDefaultPath(AutomatedInstallData idata) {
String chosenPath = "";
if (idata.getVariable(getVariableName()) != null) {
chosenPath = idata.getVariable(getVariableName());
} else {
if (OsVersion.IS_WINDOWS) {
chosenPath = idata.getVariable(getVariableName()+".windows");
}
if (OsVersion.IS_OSX) {
chosenPath = idata.getVariable(getVariableName()+".mac");
} else {
if (OsVersion.IS_UNIX) {
chosenPath = idata.getVariable(getVariableName()+".unix");
}
}
}
VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
chosenPath = vs.substitute(chosenPath, null);
return chosenPath;
}
示例2: isElevationNeeded
/**
* Checks if the current user is an administrator or not.
*
* @return <code>true</code> if elevation is needed to have administrator permissions, <code>false</code> otherwise.
*/
public boolean isElevationNeeded()
{
if (vetoed)
{
return false;
}
if (OsVersion.IS_WINDOWS)
{
return !isPrivilegedMode() && !canWriteToProgramFiles();
}
else
{
return !System.getProperty("user.name").equals("root");
}
}
示例3: itemRequiredForOs
/**
* Verifies if an item is required for the operating system the installer executed. The
* configuration for this feature is: <br/>
* <os family="unix"/> <br>
* <br>
* <b>Note:</b><br>
* If the list of the os is empty then <code>true</code> is always returnd.
*
* @param os The <code>Vector</code> of <code>String</code>s. containing the os names
* @return <code>true</code> if the item is required for the os, otherwise returns
* <code>false</code>.
*/
public boolean itemRequiredForOs(Vector<IXMLElement> os)
{
if (os.size() == 0) { return true; }
for (int i = 0; i < os.size(); i++)
{
String family = (os.elementAt(i)).getAttribute(FAMILY);
boolean match = false;
if ("windows".equals(family))
{
match = OsVersion.IS_WINDOWS;
}
else if ("mac".equals(family))
{
match = OsVersion.IS_OSX;
}
else if ("unix".equals(family))
{
match = OsVersion.IS_UNIX;
}
if (match) { return true; }
}
return false;
}
示例4: isWriteable
/**
* This method determines whether the chosen dir is writeable or not.
*
* @return whether the chosen dir is writeable or not
*/
private static boolean isWriteable(File path)
{
File existParent = IoHelper.existingParent(path);
if (existParent == null) { return false; }
// On windows we cannot use canWrite because
// it looks to the dos flags which are not valid
// on NT or 2k XP or ...
if (OsVersion.IS_WINDOWS)
{
File tmpFile;
try
{
tmpFile = File.createTempFile("izWrTe", ".tmp", existParent);
tmpFile.deleteOnExit();
}
catch (IOException e)
{
Debug.trace(e.toString());
return false;
}
return true;
}
return existParent.canWrite();
}
示例5: getDBUri
private String getDBUri(VariablesSource variablesSource) {
String db_uri = "jdbc:";
String database = getUserDB(variablesSource);
Debug.trace("getDBUri | database: " +database);
if (database.equals("pgsql")) {
db_uri += "postgresql:";
} else if (database.equals("sqlserver")) {
db_uri += "jtds:sqlserver:";
} else {
db_uri += database + ":";
}
if (database.equals("derby")) {
String derby_path = variablesSource.getVariable("DerbyDBPath");
if (OsVersion.IS_WINDOWS) {
derby_path = derby_path.replace("\\", "\\\\");
}
db_uri += derby_path;
} else if ( database.equals( "sqlserver" ) ){
db_uri += "//" + variablesSource.getVariable("dbHost");
db_uri += ";databaseName=" + variablesSource.getVariable("dbName");
db_uri += ";user=" + variablesSource.getEncodedVariable("dbUser");
if ( variablesSource.getEncodedVariable( "dbPass" ) != null
&& !variablesSource.getEncodedVariable( "dbPass" ).isEmpty() ){
db_uri += ";password=" + variablesSource.getEncodedVariable( "dbPass" );
}
db_uri += ";schema=dbo";
db_uri += ";lastUpdateCount=false";
db_uri += ";cacheMetaData=false";
} else {
db_uri += "//" + variablesSource.getVariable("dbHost");
db_uri += "/" + variablesSource.getVariable("dbName");
db_uri += "?user=" + variablesSource.getEncodedVariable("dbUser");
if (variablesSource.getEncodedVariable("dbPass") != null
&& !variablesSource.getEncodedVariable("dbPass").isEmpty()) {
db_uri += "&password=" + variablesSource.getEncodedVariable("dbPass");
}
}
return db_uri;
}
示例6: getElevator
private List<String> getElevator(String javaCommand, String installer) throws IOException, InterruptedException
{
List<String> elevator = new ArrayList<String>();
if (OsVersion.IS_OSX)
{
elevator.add(extractMacElevator().getCanonicalPath());
elevator.add(javaCommand);
elevator.add("-jar");
elevator.add(installer);
}
else if (OsVersion.IS_UNIX)
{
elevator.add("xterm");
elevator.add("-title");
elevator.add("Installer");
elevator.add("-e");
elevator.add("sudo");
elevator.add(javaCommand);
elevator.add("-jar");
elevator.add(installer);
}
else if (OsVersion.IS_WINDOWS)
{
elevator.add("wscript");
elevator.add(extractVistaElevator().getCanonicalPath());
elevator.add(javaCommand);
elevator.add("-Dizpack.mode=privileged");
elevator.add("-jar");
elevator.add(installer);
}
return elevator;
}
示例7: getJavaExecutable
private String getJavaExecutable()
{
if (OsVersion.IS_WINDOWS)
{
return "javaw.exe";
}
else
{
return "java";
}
}
示例8: addExtension
private static String addExtension(String command)
{
// This is the most common extension case - exe for windows and OS/2,
// nothing for *nix.
return command + (OsVersion.IS_WINDOWS || OsVersion.IS_OS2 ? ".exe" : "");
}
示例9: elevationShouldBeInvestigated
private static boolean elevationShouldBeInvestigated()
{
return (Uninstaller.class.getResource("/exec-admin") != null) ||
(OsVersion.IS_WINDOWS && !(new PrivilegedRunner().canWriteToProgramFiles()));
}
示例10: isPlatformSupported
/**
* Checks if the current platform is supported.
*
* @return <code>true</code> if the platform is supported, <code>false</code> otherwise.
*/
public boolean isPlatformSupported()
{
return OsVersion.IS_MAC || OsVersion.IS_UNIX || OsVersion.IS_WINDOWS;
}