blob: f918a853b6914a25c18ee61ba1c953b0ed547c14 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
******************************************************************************/
package org.eclipse.epp.wizard.internal;
/**
* @author Jordi Boehme Lopez <jboehme@innoopract.com>
*/
public class OsUtil {
public static Platform getDefaultOs( String userAgent ) {
Platform result = Platform.WIN32;
for( Platform platform : Platform.values() ) {
String platformHeader = platform.getId().substring( 0, 3 );
if( userAgent.indexOf( platformHeader ) > -1
|| userAgent.indexOf( platformHeader.toUpperCase() ) > -1
|| userAgent.indexOf( platformHeader.substring( 0, 1 ).toUpperCase()
+ platformHeader.substring( 1,
platformHeader.length() ) ) > -1 )
{
result = platform;
}
}
return result;
}
}