Monday, November 10, 2008

The Power of '\'

I recently went through an ordeal attempting to use the Flex command line compiler for a project I was working on. After figuring out a series of fairly cryptic problems I got to one which made no sense. I was getting a ‘cannot find file’ error for an asset that I knew to be in the correct position. In fact the project would build just fine within Flex Builder. The file was an embedded image asset located at something like ‘…/assets/images/image.png’. I couldn’t figure out why it would have an issue. After searching the internet for about half an hour I came across the post of another blogger with the same problem. He said that adding a ‘/’ to the front of his embedded file names fixed all of his issues. Lo and behold it worked for me as well. I guess the Flex Builder compiler is smart enough to find the files with or without the ‘/’ but the command line compiler wasn’t built with the same intelligence. I’ve also seen the power of the ‘/’ in a couple of other places even within Flex Builder such as source paths remaining unfound without the ‘/’ in front.
Lesson Learned: When in doubt, add a ‘/’ to the front of the path.

No comments: