Download folder to ApplicationData?

Hi,
I have a quick question which hopefully someone can help me with:

  1. Is it possible for a MAS app to download a folder containing files, into the app’s ApplicationData folder? Or can it only download something like a zip file?

Any pointers to examples of how to do this would be greatly appreciated.

Thank you all in advance.

[quote=195309:@Richard Summers]Hi,
I have a quick question which hopefully someone can help me with:

  1. Is it possible for a MAS app to download a folder containing files, into the app’s ApplicationData folder? Or can it only download something like a zip file?

Any pointers to examples of how to do this would be greatly appreciated.

Thank you all in advance.[/quote]

Just point a folderitem to the folder, then use CopyFileTo :
http://documentation.xojo.com/index.php/FolderItem.CopyFileTo

I do that in one of my MAS app, so I know it works fine.

I do exactly this in RegExRX with the Samples. I use an HTTPSocket and , if memory serves, unzip on the command line with ditto.

Thank you both very much.

Is there any preferred methods - such as downloading it as a folder, rather than a zip?
If I did make it downloadable as a zip, can OS X natively unzip any zip, as there are many different zip formats?

Thanks.

You can download files, not a “folder” per se, so zip is your best option.

As I said, look at ditto on the command line, or unzip.

Thanks Kem - I will look into ditto now :slight_smile:

OSX has been able to unzip anything I have given it so far, apart from passworded files.

I have seen cases where individual user’s machines lose the association of zip with the proper handler when called at the command line, so I switched to using the MBS unzip last year ‘just in case’
(Such cases need the users machine to be fixed on a one-by-one basis, but its a rare thing.)
Download a zip file, unpack it in situ, then check that it created the folder structure you expected before trying to use it.
If you shell out, you need to give it time to complete before accessing.
(another reason why I use MBS: the process is synchronous so I know it has finished before I move on)

If the required folder is not there, inform the user /try again/ report an issue back to you.

The solution to the problem above, by the way is:

Go to: ~/Library/Preferences/
find and delete this plist: com.apple.archiveutility.plist
Restart your mac.

Thanks.