Hey Michael,

> On Mar 11, 2016, at 02:51, Michael Hall <mik3h...@gmail.com> wrote:
> 
> I am trying to add some support for my application updating external files. 
> Appstore is not necessarily a major concern, but I wouldn’t want to eliminate 
> it as a possibility for no good reason by doing something unnecessarily 
> violating some app store constraint. In some quick browsing I saw no real 
> better choice to place the data than using the Application Support directory. 
> If there is a better way of handling that now please let me know. 


When your app is sandboxed, it does not have access to Application Support.
Instead, it has its own “container”. Read more about this at 
https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW15

If you want to first get started and worry about sandboxing later, Application 
Support is IMHO the right place for this kind of thing.
To migrate later, take a look at 
https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/MigratingALegacyApp/MigratingAnAppToASandbox.html#//apple_ref/doc/uid/TP40011183-CH6-SW1

To find the Application Support directory, you can use

import com.apple.eio.FileManager;
private static final int kApplicationSupportFolder = 0x61737570; // asup
String folder = FileManager.findFolder(FileManager.kUserDomain, 
kApplicationSupportFolder);

This will at least work as long as com.apple.eio.FileManager still exists (not 
sure, whether this will eventually go away with JDK9).

Whether System.getProperty("user.home”) will return the container directory for 
a sandboxed app is an interesting question that I don’t know the answer to. The 
Objective-C docs recommend to use 
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/index.html#//apple_ref/c/func/NSHomeDirectory
 to get it.

Cheers,

-hendrik

Reply via email to