Updated Branches:
  refs/heads/develop cfcdd7805 -> 58c11da06

Move OS constancy and checking code to new class


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/58c11da0
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/58c11da0
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/58c11da0

Branch: refs/heads/develop
Commit: 58c11da065d8301d8d642fc6a9d4c0c06edf4b97
Parents: cfcdd78
Author: Justin Mclean <[email protected]>
Authored: Mon Sep 30 16:41:28 2013 +1000
Committer: Justin Mclean <[email protected]>
Committed: Mon Sep 30 16:41:28 2013 +1000

----------------------------------------------------------------------
 installer/src/InstallApacheFlex.mxml            |  56 ++++------
 .../src/installer/sdk-installer-config-3.1.xml  | 109 +++++++++++++++++++
 .../org/apache/flex/packageflexsdk/model/OS.as  |  67 ++++++++++++
 3 files changed, 198 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/58c11da0/installer/src/InstallApacheFlex.mxml
----------------------------------------------------------------------
diff --git a/installer/src/InstallApacheFlex.mxml 
b/installer/src/InstallApacheFlex.mxml
index d3978d3..02199fc 100644
--- a/installer/src/InstallApacheFlex.mxml
+++ b/installer/src/InstallApacheFlex.mxml
@@ -58,6 +58,7 @@ variables are not required because the locations of these 
pieces are known.
                import mx.utils.StringUtil;
                
                import 
org.apache.flex.packageflexsdk.model.InstallerComponentVO;
+               import org.apache.flex.packageflexsdk.model.OS;
                import 
org.apache.flex.packageflexsdk.resource.ViewResourceConstants;
                import org.apache.flex.packageflexsdk.util.CalcButtonWidth;
                import org.apache.flex.packageflexsdk.util.MD5CompareUtil;
@@ -169,10 +170,6 @@ variables are not required because the locations of these 
pieces are known.
                private var RIDEAU_FILE:String;
                private var RIDEAU_URL:String;
                
-               private const WINDOWS_OS:String = "windows";
-               private const MAC_OS:String = "mac";
-               private const LINUX_OS:String = "linux";
-               
                [Bindable]
                private var _flexHome:String;
                private var _flexTemp:String;
@@ -190,7 +187,7 @@ variables are not required because the locations of these 
pieces are known.
                private var _osmfSWCFile:File;
                private var _osmfSWFFile:File;
                
-               private var _os:String;
+               private var _os:OS = new OS();
                private var _loader:URLLoader;
                private var _process:NativeProcess;
                private var _previousDisplayedPercent:int = 0;
@@ -344,7 +341,7 @@ variables are not required because the locations of these 
pieces are known.
                }
                
                protected function xmlLoaded(event:Event):void {
-                       setOSSpecificVariables();
+                       checkValidOS();
                        
                        if (setXMLVariables()) {
                                updateWindowTitle();
@@ -355,6 +352,11 @@ variables are not required because the locations of these 
pieces are known.
                        }
                }
                
+               protected function checkValidOS():void {
+                       if (_os.isOther())
+                               
log(_viewResourceConstants.ERROR_UNSUPPORTED_OPERATING_SYSTEM);
+               }
+               
                protected function setXMLVariables():Boolean {
                        var data:XML = XML(_loader.data);
                        var version:Number = Number(data.version.toString());
@@ -371,12 +373,12 @@ variables are not required because the locations of these 
pieces are known.
                        var airVersions:Array = files.(@name == 
'Versions')[email protected]().split(",");
                        var selected:String = files.(@name == 
'Versions')[email protected]();
                        for each (var airVersion:String in airVersions) {
-                               if (_os != LINUX_OS || Number(airVersion) <= 
2.6) {
+                               if (!_os.isLinux()|| Number(airVersion) <= 2.6) 
{
                                        AIR_VERSIONS.addItem({label:"AIR " + 
airVersion, version:airVersion});
                                }
                        }
                        
-                       if (_os == LINUX_OS) {
+                       if (_os.isLinux()) {
                                AIR_VERSION = "2.6";
                        }
                        
@@ -387,7 +389,7 @@ variables are not required because the locations of these 
pieces are known.
                        var flexVersions:Array = files.(@name == 
'FlexVersions')[email protected]().split(",");
                        for each (var flexVersion:String in flexVersions) {
                                var shortName:String = files.(@name == 
flexVersion)[email protected]();
-                               var fileName:String = shortName + ((_os == 
WINDOWS_OS) ? Constants.ARCHIVE_EXTENSION_WIN : 
Constants.ARCHIVE_EXTENSION_MAC);
+                               var fileName:String = shortName + 
(_os.isWindows() ? Constants.ARCHIVE_EXTENSION_WIN : 
Constants.ARCHIVE_EXTENSION_MAC);
                                var label:String = "Flex SDK " + flexVersion;
                                var ver:String = 
fileName.substr(Constants.SDK_BINARY_FILE_NAME_PREFIX.length).split("-")[0];
                                var path:String = files.(@name == 
flexVersion)[email protected]();
@@ -410,7 +412,7 @@ variables are not required because the locations of these 
pieces are known.
                        var flashPlayerVersions:Array = files.(@name == 
'Versions')[email protected]().split(",");
                        selected = files.(@name == 
'Versions')[email protected]();
                        for each (var flashPlayerVersion:String in 
flashPlayerVersions) {
-                               if (_os != LINUX_OS || 
Number(flashPlayerVersion) <= 11.2) {
+                               if (!_os.isLinux() || 
Number(flashPlayerVersion) <= 11.2) {
                                        var swfVersion:String = files.(@name == 
'FlashPlayer' + FLASH_PLAYER_VERSION)[email protected]();
                                        
FLASH_PLAYER_VERSIONS.addItem({label:"Flash Player " + flashPlayerVersion, 
version:flashPlayerVersion, swfVersion:swfVersion});
                                }
@@ -422,7 +424,7 @@ variables are not required because the locations of these 
pieces are known.
                        
                        ADOBE_AIR_SDK_WIN_FILE = files.(@name == 
'AdobeAIRSDKWin' + AIR_VERSION)[email protected]();
                        ADOBE_AIR_SDK_WIN_URL = files.(@name == 
'AdobeAIRSDKWin' + AIR_VERSION)[email protected]();
-                       if (_os == WINDOWS_OS && (!ADOBE_AIR_SDK_WIN_FILE || 
!ADOBE_AIR_SDK_WIN_URL)) {
+                       if (_os.isWindows() && (!ADOBE_AIR_SDK_WIN_FILE || 
!ADOBE_AIR_SDK_WIN_URL)) {
                                
log(_viewResourceConstants.ERROR_INVALID_AIR_SDK_URL_WINDOWS);
                                keepGoing = false;
                        }
@@ -430,7 +432,7 @@ variables are not required because the locations of these 
pieces are known.
                        
                        ADOBE_AIR_SDK_MAC_FILE = files.(@name == 
'AdobeAIRSDKMac' + AIR_VERSION)[email protected]();
                        ADOBE_AIR_SDK_MAC_URL = files.(@name == 
'AdobeAIRSDKMac' + AIR_VERSION)[email protected]();
-                       if (_os == MAC_OS && (!ADOBE_AIR_SDK_MAC_FILE || 
!ADOBE_AIR_SDK_MAC_URL)) {
+                       if (_os.isMac() && (!ADOBE_AIR_SDK_MAC_FILE || 
!ADOBE_AIR_SDK_MAC_URL)) {
                                
log(_viewResourceConstants.ERROR_INVALID_AIR_SDK_URL_MAC);
                                keepGoing = false;
                        }
@@ -438,7 +440,7 @@ variables are not required because the locations of these 
pieces are known.
                        
                        ADOBE_AIR_SDK_LINUX_FILE = files.(@name == 
'AdobeAIRSDKLin' + AIR_VERSION)[email protected]();
                        ADOBE_AIR_SDK_LINUX_URL = files.(@name == 
'AdobeAIRSDKLin' + AIR_VERSION)[email protected]();
-                       if (_os == LINUX_OS && (!ADOBE_AIR_SDK_LINUX_FILE || 
!ADOBE_AIR_SDK_LINUX_URL)) {
+                       if (_os.isLinux() && (!ADOBE_AIR_SDK_LINUX_FILE || 
!ADOBE_AIR_SDK_LINUX_URL)) {
                                
log(_viewResourceConstants.ERROR_INVALID_AIR_SDK_URL_LINUX);
                                keepGoing = false;
                        }
@@ -512,20 +514,6 @@ variables are not required because the locations of these 
pieces are known.
                        return -1;
                }
                
-               protected function setOSSpecificVariables():void {
-                       var operatingSystemStr:String = Capabilities.os;
-                       
-                       if (operatingSystemStr.search("Mac OS") != -1) {
-                               _os = MAC_OS;
-                       } else if (operatingSystemStr.search("Windows") != -1) {
-                               _os = WINDOWS_OS;
-                       } else if (operatingSystemStr.search("Linux") != -1) {
-                               _os = LINUX_OS;
-                       } else {
-                               
log(_viewResourceConstants.ERROR_UNSUPPORTED_OPERATING_SYSTEM);
-                       }
-               }
-               
                private function useMirrorPath(path:String):String {
                        if (_useMirror) {
                                return path;
@@ -578,7 +566,7 @@ variables are not required because the locations of these 
pieces are known.
                        var currentVersion:String = 
applicationDescriptor.xmlns::versionNumber.toString();
                        
                        // Log the Installer version to help with any support 
issues that arise.
-                       log("Version " + currentVersion + " (" + _os + ")", 0);
+                       log("Version " + currentVersion + " (" + _os.os + ")", 
0);
                        
                        var availBuildNumbers:Array = _latestVersion.split(".");
                        var currentBuildNumbers:Array = 
currentVersion.split(".");
@@ -859,7 +847,7 @@ variables are not required because the locations of these 
pieces are known.
                        try {
                                log(_viewResourceConstants.INFO_UNZIPPING + 
_apacheFlexSDKCompressedFile.nativePath);
                                
-                               if (_os == WINDOWS_OS) {
+                               if (_os.isWindows()) {
                                        unzip(_apacheFlexSDKCompressedFile, 
handleApacheFlexSDKZipFileUnzipComplete, handleApacheFlexSDKZipFileUnzipError);
                                } else {
                                        untar(_apacheFlexSDKCompressedFile, 
_flexTempDir, handleApacheFlexSDKZipFileUnzipComplete, 
handleApacheFlexSDKZipFileUnzipError);
@@ -874,7 +862,7 @@ variables are not required because the locations of these 
pieces are known.
                        log(_viewResourceConstants.INFO_FINISHED_UNZIPPING + 
_apacheFlexSDKCompressedFile.nativePath);
                        
updateActivityStep(_viewResourceConstants.STEP_UNZIP_FLEX_SDK, 
StepItem.COMPLETE);
                        
-                       if (_os == WINDOWS_OS) {
+                       if (_os.isWindows()) {
                                downloadAIRRuntimeKitForWindows();
                        } else {
                                /* Copy all files from the unarchived directory 
to the root */
@@ -884,7 +872,7 @@ variables are not required because the locations of these 
pieces are known.
                                        
file.copyTo(_flexHomeDir.resolvePath(file.name));
                                }
                                
-                               if (_os == MAC_OS) {
+                               if (_os.isMac()) {
                                        downloadAIRRuntimeKitForMac();
                                }
                                else {
@@ -960,7 +948,7 @@ variables are not required because the locations of these 
pieces are known.
                        
updateActivityStep(_viewResourceConstants.STEP_UNZIP_AIR_RUNTIME_KIT, 
StepItem.ACTIVE);
                        
                        try {
-                               if (_os == WINDOWS_OS) {
+                               if (_os.isWindows()) {
                                        unzipAdobeAIRSDKWindows()
                                } else {
                                        unzipAdobeAIRSDKMac();
@@ -1399,7 +1387,7 @@ variables are not required because the locations of these 
pieces are known.
                                }
                        }
                        if (allComponentsInstalled) {
-                               
tracker.trackInstallerSuccess(APACHE_FLEX_BIN_DISTRO_VERSION,_os);
+                               
tracker.trackInstallerSuccess(APACHE_FLEX_BIN_DISTRO_VERSION, _os.os);
                                cleanup(false);
                        }
                }
@@ -1653,7 +1641,7 @@ variables are not required because the locations of these 
pieces are known.
                        var startupInfo:NativeProcessStartupInfo = new 
NativeProcessStartupInfo();
                        var arguments:Vector.<String> = new Vector.<String>();
                        
-                       if (_os == LINUX_OS) {
+                       if (_os.isLinux()) {
                                tar = new File("/bin/tar");
                        }
                        else {

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/58c11da0/installer/src/installer/sdk-installer-config-3.1.xml
----------------------------------------------------------------------
diff --git a/installer/src/installer/sdk-installer-config-3.1.xml 
b/installer/src/installer/sdk-installer-config-3.1.xml
new file mode 100644
index 0000000..b9605dd
--- /dev/null
+++ b/installer/src/installer/sdk-installer-config-3.1.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+
+<config>
+       <version>
+               <latest>2.6.1</latest>
+       </version>
+       <files>
+
+               <!-- SDK Installer Application binary distribution
+                        Notes:
+                               - use full URL when binaries are NOT released 
yet, else use
+                                 path relative to mirror
+                               - if path is relative, don't use starting slash 
-->
+               <file name="SDKInstallerApp" 
path="https://dist.apache.org/repos/dist/dev/flex/installer/2.0/rc1/binaries/"; 
file="apache-flex-sdk-installer-2.0.3-bin" />
+
+        <!-- Mirror URL CGI -->
+        <file name="MirrorURLCGI" path="" file="single-mirror-url.cgi"/>
+
+               <file name="FlexVersions" versions="4.10.0 RC3,4.9.1,Nightly" 
default="4.10.0 RC3" />
+
+        <!-- Apache Flex binary distribution
+             Notes:
+                 - path is relative to mirror URL; don't use starting slash
+                 - use http based url if you want to use an absolute url 
instead of mirror
+                 - remove the extension from the file name -->
+               <file name="4.10.0 RC3" 
path="https://dist.apache.org/repos/dist/dev/flex/sdk/4.10.0/rc3/binaries/"; 
file="apache-flex-sdk-4.10.0-bin"/>
+               <file name="4.9.1" path="flex/4.9.1/binaries/" 
file="apache-flex-sdk-4.9.1-bin"/>
+               <file name="Nightly" 
path="https://builds.apache.org/job/flex-sdk_release/lastSuccessfulBuild/artifact/out/";
 file="apache-flex-sdk-4.10.0-bin" /> 
+
+        <!-- All the versions! -->
+               <file name="Versions" 
airVersions="3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3.0,2.7,2.6" 
flashPlayerVersions="11.8,11.7,11.6,11.5,11.4,11.3,11.2,11.1,11.0,10.3,10.2" 
airDefault="3.8" flashPlayerDefault="11.8" /> 
+
+        <!-- Adobe AIR SDK -->
+               <file name="AdobeAIRSDKLin2.6" 
path="http://airdownload.adobe.com/air/lin/download/2.6/"; 
file="AdobeAIRSDK.tbz2" />
+               
+               <file name="AdobeAIRSDKWin2.6" 
path="http://airdownload.adobe.com/air/win/download/2.6/"; 
file="AdobeAIRSDK.zip" /> 
+               <file name="AdobeAIRSDKWin2.7" 
path="http://airdownload.adobe.com/air/win/download/2.7/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.0" 
path="http://airdownload.adobe.com/air/win/download/3.0/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.1" 
path="http://airdownload.adobe.com/air/win/download/3.1/"; 
file="AdobeAIRSDK.zip" label="tested" />
+               <file name="AdobeAIRSDKWin3.2" 
path="http://airdownload.adobe.com/air/win/download/3.2/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.3" 
path="http://airdownload.adobe.com/air/win/download/3.3/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.4" 
path="http://airdownload.adobe.com/air/win/download/3.4/"; 
file="AdobeAIRSDK.zip" label="tested" />
+               <file name="AdobeAIRSDKWin3.5" 
path="http://airdownload.adobe.com/air/win/download/3.5/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.6" 
path="http://airdownload.adobe.com/air/win/download/3.6/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.7" 
path="http://airdownload.adobe.com/air/win/download/3.7/"; 
file="AdobeAIRSDK.zip" />
+               <file name="AdobeAIRSDKWin3.8" 
path="http://airdownload.adobe.com/air/win/download/3.8/"; 
file="AdobeAIRSDK.zip" />
+
+               <file name="AdobeAIRSDKMac2.6" 
path="http://airdownload.adobe.com/air/mac/download/2.6/"; 
file="AdobeAIRSDK.tbz2" /> 
+               <file name="AdobeAIRSDKMac2.7" 
path="http://airdownload.adobe.com/air/mac/download/2.7/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.0" 
path="http://airdownload.adobe.com/air/mac/download/3.0/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.1" 
path="http://airdownload.adobe.com/air/mac/download/3.1/"; 
file="AdobeAIRSDK.tbz2" label="tested" />
+               <file name="AdobeAIRSDKMac3.2" 
path="http://airdownload.adobe.com/air/mac/download/3.2/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.3" 
path="http://airdownload.adobe.com/air/mac/download/3.3/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.4" 
path="http://airdownload.adobe.com/air/mac/download/3.4/"; 
file="AdobeAIRSDK.tbz2" label="tested" />
+               <file name="AdobeAIRSDKMac3.5" 
path="http://airdownload.adobe.com/air/mac/download/3.5/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.6" 
path="http://airdownload.adobe.com/air/mac/download/3.6/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.7" 
path="http://airdownload.adobe.com/air/mac/download/3.7/"; 
file="AdobeAIRSDK.tbz2" />
+               <file name="AdobeAIRSDKMac3.8" 
path="http://airdownload.adobe.com/air/mac/download/3.8/"; 
file="AdobeAIRSDK.tbz2" />
+               
+               <!-- Adobe Flash Player player global swc -->
+               <file name="FlashPlayer10.2" 
path="http://download.macromedia.com/get/flashplayer/installers/archive/playerglobal";
 file="playerglobal10_2.swc" version="10.2" swfversion="11" />
+               <file name="FlashPlayer10.3" 
path="http://download.macromedia.com/get/flashplayer/installers/archive/playerglobal";
 file="playerglobal10_3.swc" version="10.3" swfversion="12" />
+               <file name="FlashPlayer11.0" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_0.swc" version="11.0" swfversion="13" />
+               <file name="FlashPlayer11.1" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_1.swc" version="11.1" swfversion="14" label="tested" />
+               <file name="FlashPlayer11.2" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_2.swc" version="11.2" swfversion="15" />
+               <file name="FlashPlayer11.3" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_3.swc" version="11.3" swfversion="16" />
+               <file name="FlashPlayer11.4" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_4.swc" version="11.4" swfversion="17" label="tested" />
+               <file name="FlashPlayer11.5" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_5.swc" version="11.5" swfversion="18" />
+               <file name="FlashPlayer11.6" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_6.swc" version="11.6" swfversion="19" />
+               <file name="FlashPlayer11.7" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_7.swc" version="11.7" swfversion="20" />
+               <file name="FlashPlayer11.8" 
path="http://download.macromedia.com/get/flashplayer/updaters/11/"; 
file="playerglobal11_8.swc" version="11.8" swfversion="21" />                   
+        
+        <!-- SWFObject.js -->
+        <file name="swfobject" path="http://swfobject.googlecode.com/files/"; 
file="swfobject_2_2.zip"/>
+
+        <!-- BlazeDS -->
+        <file name="BlazeDS" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/lib/"; 
file="flex-messaging-common.jar"/>
+
+        <!-- FontSWF -->
+        <file name="afe" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/lib/"; 
file="afe.jar"/>
+        <file name="aglj40" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/lib/"; 
file="aglj40.jar"/>
+        <file name="flex-fontkit" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/lib/"; 
file="flex-fontkit.jar"/>
+        <file name="rideau" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/lib/"; 
file="rideau.jar"/>
+
+        <!-- OSMF -->
+        <file name="OSMF_SWF" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/frameworks/libs/";
 file="osmf.swf"/>
+        <file name="OSMF_SWC" 
path="http://opensource.adobe.com/svn/opensource/flex/sdk/branches/4.y/frameworks/libs/";
 file="osmf.swc"/>
+
+    </files>
+</config>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/58c11da0/installer/src/org/apache/flex/packageflexsdk/model/OS.as
----------------------------------------------------------------------
diff --git a/installer/src/org/apache/flex/packageflexsdk/model/OS.as 
b/installer/src/org/apache/flex/packageflexsdk/model/OS.as
new file mode 100644
index 0000000..ccdde59
--- /dev/null
+++ b/installer/src/org/apache/flex/packageflexsdk/model/OS.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.packageflexsdk.model
+{
+       import flash.system.Capabilities;
+       
+       import org.apache.flex.packageflexsdk.resource.ViewResourceConstants;
+       
+       public class OS
+       {
+               public const WINDOWS:String = "windows";
+               public const MAC:String = "mac";
+               public const LINUX:String = "linux";
+               
+               public var os:String = null;
+               
+               public function OS()
+               {
+                       setOS();
+               }
+               
+               public function isWindows():Boolean {
+                       return os == WINDOWS;
+               }
+               
+               public function isMac():Boolean {
+                       return os == MAC;
+               }
+               
+               public function isLinux():Boolean {
+                       return os == LINUX;
+               }
+               
+               public function isOther():Boolean {
+                       return !(isWindows() || isMac() || isLinux());
+               }
+               
+               private function setOS():void {
+                       var operatingSystem:String = Capabilities.os;
+                       
+                       if (operatingSystem.search("Mac OS") != -1) {
+                               os = MAC;
+                       } else if (operatingSystem.search("Windows") != -1) {
+                               os = WINDOWS;
+                       } else if (operatingSystem.search("Linux") != -1) {
+                               os = LINUX;
+                       }
+               }
+       }
+}

Reply via email to