App Store Data as Directory?

I have a few apps that I sell from my website as well as through the App Store. Occasionally customers switch from an app store version to a non-app store version or vice versa. I am building a little data migration utility to migrate app data between the two data storage locations. However, I’m having a problem with getting a proper folderItem for the app store application data folder. When I tried this:

thePath = SpecialFolder.UserLibrary.naturalPath + "/Containers/com.ttpsoftware." + lowerCase(PopupMenu1.text) + "/Data/Library/Application Support/" + PopupMenu1.text f = GetFolderItem(thePath)
the resulting folderItem was not a directory. i.e. f.directory = false.
Is there some way I can get a folderItem for the app store data folder that recognizes it as a folder?

That should have been NativePath not NaturalPath :slight_smile:

From what I see, a sandboxed app depends on a container set by the system for the machine it runs on. So I doubt a non sandboxed application can guess where that could be.

Why not have an “export” option that zips the content of the date folder and lets the user save the archive ?
Then you can have an “import” option to load the zip and extract it in the data folder.

My own solution is to sandbox the apps I have on the website, so they will use the very same data folder no matter if App Store or not. But the backup/restore feature is still available.

I don’t know if this will work better but you should build the path the correct way :slight_smile:

    f = SpecialFolder.UserLibrary.Child("Containers").Child("com.ttpsoftware." + lowerCase(PopupMenu1.text)).Child("Data").Child("Library").Child("Application Support").Child(PopupMenu1.text)

Michel, two good ideas! I never thought of sandboxing my downloadable apps and an export/import solution also would work. Thanks.

Albin, thanks, I’ll give that a try.