The code makes an initial command line, then separates them into String[]. A bit later it joins the String[] back to string, adds more arguments, and splits it again. I think it sounds simpler than it is, but that's the gist of it. I think the code should have been written to just create an ArrayList of all the arguments and then turn that into an Array when ready to launch the compiler; that's how I would ultimately solve it.
--peter On 8/23/12 12:01 PM, "Alex Harui" <aha...@adobe.com> wrote: >It might be better to figure out how to quote those entries. Why was it >hard to do that as the command line gets built up? > > >On 8/23/12 8:55 AM, "Peter Ent" <p...@adobe.com> wrote: > >> Certainly appreciate the help. Here's a typical one when running >>Mustella: >> >> -debug -define=CONFIG::skaha,false >> >>-compiler.fonts.managers=flash.fonts.JREFontManager,flash.fonts.AFEFontMa >>na >> ger,flash.fonts.BatikFontManager,flash.fonts.CFFFontManager >> -source-path=/Users/pent/apache/flex/mustella/Assets >> -includes=ExcludeFileLocation -includes=SetShowRTE >> -includes=SaveBitmapFailures >> -includes=datagrid_properties_lockedColumnCount_mxml >> >>-source-path=/Users/pent/apache/flex/mustella/tests/components/DataGrid/D >>at >> aGrid_SparkSkin/Properties --allow-source-path-overlap=true >> -includes=SendResultsToRunner -includes=ExitWhenDone -source-path=. >> -source-path=/Users/pent/apache/flex/mustella/../frameworks/ >> -source-path=/Users/pent/apache/flex/mustella/as3/src/mustella >> >> Try changing my path, "/Users/pent/apache/" to something like >> "/Users/pent/apache with spaces/" to get a better example. >> >> What happens in the code is that groups of these options may be coming >> from the environment, so you might find "-debug >> -define=CONFIG::skaha,false" being added as a single entity. Then code >> turns what it has at the moment into a String[] and passes that to >>another >> function that might add more arguments. If that function does, it will >> turn the String[] back into a String, add the arguments, then turn it >>back >> into String[]. >> >> But if you can make something that will convert the args into an >> acceptable String[] it would be super-helpful. >> >> Thanks! >> --peter >> >> On 8/23/12 11:44 AM, "Kessler CTR Mark J" <mark.kessler....@usmc.mil> >> wrote: >> >>> String.split(regexpattern) can match pretty much anything. Definitely >>> would be able to comeup with a pattern to match embedded dashes. >>> >>> I'll see if I can come up with something that can properly strip down a >>> completed command with arguments. If you would give me a more complex >>> command line that would be great. I can test against it. >>> >>> Currently my setup uses few command line arguments and instead adds to >>> the "-load-config+=mycustomconfig.xml" >>> >>> -----Original Message----- >>> From: Peter Ent [mailto:p...@adobe.com] >>> Sent: Thursday, August 23, 2012 10:52 >>> To: flex-dev@incubator.apache.org >>> Subject: Re: Getting Mustella to work. >>> >>> I tried something like that, but there are options like: -source-path= >>> with a hyphen in the option and a couple that begin with double >>>hyphens. >>> I started to switch over to String.split(" -") to break apart on the >>> space+dash but then ran into this mysterious problem of mxmlc not >>>liking >>> the arguments it was given, even though, as far as I can tell, it was >>> getting the same ones in the same order. Obviously that wasn't the >>>case, >>> but had trouble tracking it down, so it is on hold for now while we get >>> the tests to run, unless someone else wants to take a stab at it. >>> >>> --peter >>> >>> On 8/23/12 10:43 AM, "Kessler CTR Mark J" <mark.kessler....@usmc.mil> >>> wrote: >>> >>>> I'm not sure what Mustella is written in, but would something generic >>>> like this work? >>>> >>>> If a string needs to be turned into an array then maybe... Use the "-" >>>> as the first delimiter to break apart the options and use a temp >>>>array. >>>> Then use the "=" to break out the names from the values. >>>> >>>> Keeping two arrays with the same number of elements. One array stores >>>> the argument name and the second argument value. >>>> >>>> //Declare arrays/string >>>> string [] saNames = {"Option1", "Option2", "Option3"}; string [] >>>> saValues = {"My value with spaces", "test2", "test 3"}; string >>>> sCombinedOptions = ""; >>>> >>>> //Loop through all elements in arrays >>>> for (;;) >>>> { >>>> //Combine names / values. >>>> sCombinedOptions += saNames[currentItem] + "=""" + >>>> saValues[currentItem] + """ "; } >>>> >>>> >>>> //Add the command line and options. >>>> "path\mxmlc.exe" + " " + sCombinedOptions; >>>> >>>> >>>> -----Original Message----- >>>> From: Peter Ent [mailto:p...@adobe.com] >>>> Sent: Thursday, August 23, 2012 9:33 >>>> To: flex-dev@incubator.apache.org >>>> Subject: Re: Getting Mustella to work. >>>> >>>> That ought to work, but does not. The Mustella code pieces together a >>>> large string with all of the options on it, then turns the string into >>>> a String[] by using space as the delimiter. Thus >>>> >>>> -source-path="C:\Program Files\Common Files\Microsoft >>>> Shared\MSInfo\MSInfo32.exe" >>>> >>>> turns into >>>> [] = -source-path="C:\Program Files\Common [] = Files\Microsoft [] = >>>> Shared\MSInfo\MSInfo32.exe" >>>> >>>> And it does this several times (turning the array into a string, >>>> inserting other args, back to an array) to build up the argument list. >>>> Ultimately, the array of options is passed over to mxmlc to execute, >>>>so >>>> it does need to turn into an array of options. I was working on >>>>putting >>>> everything into an ArrayList but more and more code needed to change >>>> and then I was getting errors from mxmlc saying parameters were being >>>> mixed which I didn't understand since it was getting the same >>>> parameters in the same order. >>>> >>>> So I have to re-think the approach. >>>> >>>> --peter >>>> >>>> On 8/23/12 6:59 AM, "Kessler CTR Mark J" <mark.kessler....@usmc.mil> >>>> wrote: >>>> >>>>> I know this may sound silly, but windows deals with the spaces in >>>>>path >>>>> using quotes around the whole path. Is there something similar with >>>>> Mustella? >>>>> >>>>> So a windows command prompt example, I could do something like the >>>>> following... >>>>> "C:\Program Files\Common Files\Microsoft Shared\MSInfo\MSInfo32.exe" >>>>> >>>>> >>>>> Whereas the old non spaced dos style naming convention would do this >>>>> without quotes.. >>>>> c:\progra~1\common~1\micros~1\msinfo\MSInfo32.exe >>>>> >>>>> >>>>> r/s >>>>> -Mark >>>>> >>>>> -----Original Message----- >>>>> From: Peter Ent [mailto:p...@adobe.com] >>>>> Sent: Wednesday, August 22, 2012 9:20 >>>>> To: flex-dev@incubator.apache.org >>>>> Subject: Re: Getting Mustella to work. >>>>> >>>>> I have not have luck solving the problem. It is much trickier than I >>>>> anticipated. I am going to jump back into getting more tests to run >>>>> and think more about the problem. Operating systems have allowed >>>>> spaces in file names for many, many years and you'd think would be an >>>>> easily solvable problem (or not even a problem at all). >>>>> >>>>> --peter >>>>> >>>>> On 8/21/12 11:12 PM, "Justin Mclean" <jus...@classsoftware.com> >>>>>wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> If the space path issue was fixed you have more to add. Any luck >>>>>>with >>>>>> that yet? >>>>>> >>>>>> Justin >>>>> >>>> >>> >> > >-- >Alex Harui >Flex SDK Team >Adobe Systems, Inc. >http://blogs.adobe.com/aharui >