Allow specifying the directory to save downloaded apps in; add the calculated app directory name to the manifest as "shortname"

This patch allows the directory that apps will be downloaded into by passing the "directory" parameter to the fetch_application function.

I'm not sure if "shortname" is a good name for the calculated directory name (that strips out spaces, lowercases everything, etc.) but I couldn't think of anything better.

Also, the manifest is returned from fetch_application so that callers can examine the manifest. (In my case, I need to examine the "shortname" key)