You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/07/30 21:40:25 UTC

svn commit: r1367245 - /incubator/flex/trunk/ide/constructFlexForIDE.bat

Author: cframpton
Date: Mon Jul 30 19:40:24 2012
New Revision: 1367245

URL: http://svn.apache.org/viewvc?rev=1367245&view=rev
Log:
Fix quoting issues if multiple pieces of the path of a directory spec were quoted, such as  C:\"Program Files"\Adobe\"Adobe Flash Builder 4.6"\sdks\4.6.0.

Modified:
    incubator/flex/trunk/ide/constructFlexForIDE.bat

Modified: incubator/flex/trunk/ide/constructFlexForIDE.bat
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/ide/constructFlexForIDE.bat?rev=1367245&r1=1367244&r2=1367245&view=diff
==============================================================================
--- incubator/flex/trunk/ide/constructFlexForIDE.bat (original)
+++ incubator/flex/trunk/ide/constructFlexForIDE.bat Mon Jul 30 19:40:24 2012
@@ -1,4 +1,5 @@
 @echo off
+setlocal 
 
 REM ################################################################################
 REM ##
@@ -44,45 +45,54 @@ REM
 REM    The Adobe Flex 4.6 SDK is available here:
 REM         http://www.adobe.com/devnet/flex/flex-sdk-download.html
 REM
-REM    Usage: constructFlexForIDE "Apache Flex dir" [Adobe Flex 4.6 dir]
+REM    Usage: constructFlexForIDE "Apache Flex dir" ["Adobe Flex 4.6 dir"]
 REM
 
 REM
 REM     If the Adobe Flex SDK 4.6 directory is not specified this script will look for it
 REM     in the following places:
 REM
-REM     %ProgramFiles%\\Adobe\Adobe Flash Builder %ver%\sdks
-REM         where %ProgramFiles% expands correctly for 32-bit and 64-bit
-REM         and %ver% looks in 4.6, 4.5, and 4.7 
+REM     %ProgramFiles%/Adobe/Adobe Flash Builder 4.5/sdks/4.6.0
+REM     %ProgramFiles%/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0
+REM     %ProgramFiles%/Adobe/Adobe Flash Builder 4.7/sdks/4.6.0
+REM         where %ProgramFiles% is the Windows environment variable which expands 
+REM         correctly for 32-bit and 64-bit Windows
 
-set ADOBE_FLEX_SDK_DIR=
+set param1=%~f1
+set param2=%~f2
 
 :getApacheFlexDir
-set IDE_SDK_DIR=%~f1
-if not ["%IDE_SDK_DIR%"] == [] goto checkApacheFlexDir
-echo Usage: %0 "Apache Flex dir" [Adobe Flex SDK 4.6 dir]
+REM     Remove all quotes (%param1:"=%) and replace with outer quotes
+set IDE_SDK_DIR="%param1:"=%"
+
+if not [%IDE_SDK_DIR%] == [] goto gotApacheFlexDir
+echo Usage: %0 "Apache Flex dir" ["Adobe Flex SDK 4.6 dir"]
 goto :eof
 
+:gotApacheFlexDir
+echo The Apache Flex directory for the IDE is %IDE_SDK_DIR%
+
 REM
 REM     If this is an Apache Flex dir then there should be a NOTICE file.
 REM
 :checkApacheFlexDir
-if exist "%IDE_SDK_DIR%\NOTICE" goto checkApacheFlexBinaries
-echo "%IDE_SDK_DIR%" does not appear to be a Apache Flex distribution.
+if exist %IDE_SDK_DIR%\NOTICE goto checkApacheFlexBinaries
+echo %IDE_SDK_DIR% does not appear to be an Apache Flex distribution.
 goto :eof
 
 REM
 REM     Quick check to see if there are binaries in the Apache distribution.
 REM
 :checkApacheFlexBinaries
-if exist "%IDE_SDK_DIR%\lib\mxmlc.jar" goto getAdobeFlexDir
-echo "%IDE_SDK_DIR%" does not appear to be a Apache Flex distribution with binaries.
-echo If it is a source distribution you must build the binaries first.  See the README.
+if exist %IDE_SDK_DIR%\lib\mxmlc.jar goto getAdobeFlexDir
+echo %IDE_SDK_DIR% does not appear to be a Apache Flex distribution with binaries.
+echo If this is a source distribution of Apache Flex you must build the binaries first.
+echo See the README.
 goto :eof
 
 :getAdobeFlexDir
-if not [%2] == [] (
-    set ADOBE_FLEX_SDK_DIR=%~f2
+if not [%param2%] == [] (
+    set ADOBE_FLEX_SDK_DIR="%param2:"=%"
     goto gotAdobeFlexSDK
 )
 
@@ -90,9 +100,10 @@ REM
 REM     Look for FlashBuilder versions 4.5, 4.7 and 4.6.  End with 4.6 so
 REM     ADOBE_FLEX_SDK_DIR will be 4.6 if no SDK is found and an error is printed.
 REM
+set ADOBE_FLEX_SDK_DIR=
 for %%V in (4.5 4.6 4.7) do ( 
     if exist "%ProgramFiles%\Adobe\Adobe Flash Builder %%V\sdks\4.6.0" (
-        set ADOBE_FLEX_SDK_DIR=%ProgramFiles%\Adobe\Adobe Flash Builder %%V\sdks\4.6.0
+        set ADOBE_FLEX_SDK_DIR="%ProgramFiles%\Adobe\Adobe Flash Builder %%V\sdks\4.6.0"
         goto gotAdobeFlexSDK
     )
 )
@@ -104,16 +115,15 @@ echo Enter directory of an Adobe Flex SD
 set /p ADOBE_FLEX_SDK_DIR=
 
 :gotAdobeFlexSDK
-echo The Apache Flex directory for the IDE is "%IDE_SDK_DIR%"
-echo The Adobe Flex directory is "%ADOBE_FLEX_SDK_DIR%"
+echo The Adobe Flex directory is %ADOBE_FLEX_SDK_DIR%
 echo.
 
 REM
 REM     Quick check to see if it is a Flex SDK.
 REM
 :checkAdobeFlexSDK
-if exist "%ADOBE_FLEX_SDK_DIR%\license-adobesdk.htm" goto copyAdobeAIRSDK
-echo "%ADOBE_FLEX_SDK_DIR%" does not appear to be an Adobe Flex SDK
+if exist %ADOBE_FLEX_SDK_DIR%\license-adobesdk.htm goto copyAdobeAIRSDK
+echo %ADOBE_FLEX_SDK_DIR% does not appear to be an Adobe Flex SDK
 goto :eof
 
 
@@ -122,7 +132,7 @@ REM     Copy all the AIR SDK files to th
 REM     Copy files first, then directories with (/s).
 REM
 :copyAdobeAIRSDK
-echo Copying the AIR SDK files to "%IDE_SDK_DIR%"
+echo Copying the AIR SDK files to %IDE_SDK_DIR%
 
 for %%G in (
     "AIR SDK license.pdf"
@@ -132,8 +142,8 @@ for %%G in (
     lib\adt.jar
     samples\descriptor-sample.xml) do (
     
-    if exist "%ADOBE_FLEX_SDK_DIR%"\%%G (
-        copy /y "%ADOBE_FLEX_SDK_DIR%"\%%G "%IDE_SDK_DIR%"\%%G
+    if exist %ADOBE_FLEX_SDK_DIR%\%%G (
+        copy /y %ADOBE_FLEX_SDK_DIR%\%%G %IDE_SDK_DIR%\%%G
     )
 )
 
@@ -156,10 +166,10 @@ for %%G in (
     templates\air
     templates\extensions) do (
     
-    if exist "%ADOBE_FLEX_SDK_DIR%"\%%G (
+    if exist %ADOBE_FLEX_SDK_DIR%\%%G (
         REM    Make the directory so it won't prompt for file or directory.
-        if not exist "%IDE_SDK_DIR%"\%%G mkdir "%IDE_SDK_DIR%"\%%G
-        xcopy /q /y /e /i /c /r "%ADOBE_FLEX_SDK_DIR%"\%%G "%IDE_SDK_DIR%"\%%G
+        if not exist %IDE_SDK_DIR%\%%G mkdir %IDE_SDK_DIR%\%%G
+        xcopy /q /y /e /i /c /r %ADOBE_FLEX_SDK_DIR%\%%G %IDE_SDK_DIR%\%%G
         if %errorlevel% NEQ 0 GOTO errorExit
     )
 )
@@ -167,7 +177,7 @@ for %%G in (
 REM
 REM     Copy all the third-party files from the Adobe Flex SDK to the IDE SDK.
 REM
-echo Copying the third-party files to "%IDE_SDK_DIR%"
+echo Copying the third-party files to %IDE_SDK_DIR%
 
 for %%G in (
     frameworks\libs\player\11.1
@@ -176,7 +186,7 @@ for %%G in (
     runtimes\player\11.1\mac
     runtimes\player\11.1\win) do (
     
-    if not exist "%IDE_SDK_DIR%"\%%G mkdir "%IDE_SDK_DIR%"\%%G
+    if not exist %IDE_SDK_DIR%\%%G mkdir %IDE_SDK_DIR%\%%G
     if %errorlevel% NEQ 0 GOTO errorExit
 )
 
@@ -195,14 +205,14 @@ for %%G in (
     runtimes\player\11.1\mac
     runtimes\player\11.1\win) do (
     
-    copy /y "%ADOBE_FLEX_SDK_DIR%"\%%G "%IDE_SDK_DIR%"\%%G
+    copy /y %ADOBE_FLEX_SDK_DIR%\%%G %IDE_SDK_DIR%\%%G
 )
 
 REM
 REM     Copy config files formatted for IDE to frameworks.
 REM
 echo Copying frameworks config files configured for use without environment variables
-copy /y "%IDE_SDK_DIR%"\ide\flashbuilder\config\*-config.xml "%IDE_SDK_DIR%\frameworks"
+copy /y %IDE_SDK_DIR%\ide\flashbuilder\config\*-config.xml %IDE_SDK_DIR%\frameworks
 
 goto :eof