views:

320

answers:

2

To package an .air file into a native installer you have to use a batch program called adt.

The command on Windows will look something like this:

C:\Users\jisaacks>"C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin\adt" -package -target native "D:\DEV\Flex4\Workspaces\AIR Native Packager\AIRNIP\AIRNIP.exe" "D:\DEV\Flex4\Workspaces\AIR Native Packager\AIRNIP\AIRNIP.air"

I am trying to author a program in AIR that does this for you. Basically you drag/drop an .air file into it and it packages it into a native installer.

Well It gave me an Error #3219 error, which I looked up and found this:

AIR on Windows does not allow you to run .bat files directly. Windows .bat files are executed by the command interpreter application (cmd.exe). When you invoke a .bat file, this command application can interpret arguments passed to the command as additional applications to launch. A malicious injection of extra characters in the argument string could cause cmd.exe to execute a harmful or insecure application. For example, without proper data validation, your AIR application may call myBat.bat myArguments c:/evil.exe. The command application would launch the evil.exe application in addition to running your batch file.

If you call the start() method with a .bat file, the NativeProcess object throws an exception. The message property of the Error object contains the string "Error #3219: The NativeProcess could not be started."

I am wondering if there is a possible work around or if I have hit a brick wall?

A: 

I believe you have hit a brick wall, at least with trying to do this in Adobe Air. Executing batch files can be a huge security hole, as your post claimed.

Are you trying to do this in Air for portability, or would you be able to use some other language?

I suggest trying to code this in python. Using the subprocesslibrary can help a lot.

http://docs.python.org/release/2.5.2/lib/module-subprocess.html

Charles Ray
A: 

Serge Jespers (Adobe Evangelist) (http://www.webkitchen.be/) has done exactly this, I think you should try to contact him for the details.

I helped him build a first solution by creating a windows executable which executed any bat file you specified, later he changed it by calling the java application (adt) directly which works fine as well.

He'll be very happy to help you.

UPDATE: You can download the Package Assitant Pro right here: http://www.webkitchen.be/package-assistant-pro/

TimothyP
PS: I have notified him of this message so he can get back to you when he is available.
TimothyP
@TimothyP Awesome thanks, so I need not try to contact him then?
John Isaacks
You can still try to contact him, he'd be happy to answer all your questions :)
TimothyP
Thanks, I sent him an email.
John Isaacks