Accessing Documents directory in Mac App Store published app?

In our games we have the ability to use the pasteboard plugin to allow for exporting/importing save file data through the clipboard for debugging purposes. This has also proved useful for players who have issues as they are able to send us their save files and we can then test with their game states.

For the desktop versions we’ve had to resort to saving out a file with the required data which can then be emailed to us, this is saved into the system.DocumentsDirectory and when building for a self-distributed .dmg this is all accessible in “~/Library/Application Support/GameName/Documents”.

My question is, can this directory be accessed by players who have installed the game from the Mac App Store or is it completely inaccessible to them?

They are somewhat harder to find but they are accessible. 

The paths look like:

~/Library/Containers/{CFBundleIdentifier}/Data/Library/Application Support/{APPNAME}/Documents ~/Library/Containers/{CFBundleIdentifier}/Data/Library/Application Support/{APPNAME}/tmp

So, for example:

~/Library/Containers/com.coronalabs.osx.pewpew/Data/Library/Application Support/PewPew/Documents ~/Library/Containers/com.coronalabs.osx.pewpew/Data/Library/Application Support/PewPew/tmp

The apparent repetition in the paths is due to the ability to build apps for either Mac App Store or self distribution.

For things like support emails, you can do quite a bit with mailto URLs on OS X, e.g.

system.openURL('mailto:corona@example.com?cc=bar@example.com&subject=Greetings%20from%20Palo%20Alto!&body=Corona%20SDK%20rules!')

will open a new message in Mail.app with everything filled in ready to send (I haven’t tried sending 20KB of text this way but you could experiment to determine the limits).

That is indeed a weird path but all seems to work here, that’s great!

I haven’t tried the mailto link yet, however I’d prefer not to use it simply because I’m assuming it’d only work on computers that have Mail.app set up? I personally don’t use Mail.app and I’m sure a lot others don’t either sadly.

Do you happen to know what the equivalent path is for Windows, or is that dependant on various factors like version?

Any mail application should handle mailto: URLs just fine.  

99% of non-programmers never change the defaults on their computer so (aside from those reading email in their browser) I would expect most Mac users to use Mail.app simply because it’s the default.

To find the location of any system path, just print it out:

print("system.DocumentsDirectory: ", system.pathForFile("", system.DocumentsDirectory))

That’s a good point actually, definitely something worth thinking about.

That’s great! for some reason I didn’t think pathForFile would give me a valid path. Really don’t know why though.

They are somewhat harder to find but they are accessible. 

The paths look like:

~/Library/Containers/{CFBundleIdentifier}/Data/Library/Application Support/{APPNAME}/Documents ~/Library/Containers/{CFBundleIdentifier}/Data/Library/Application Support/{APPNAME}/tmp

So, for example:

~/Library/Containers/com.coronalabs.osx.pewpew/Data/Library/Application Support/PewPew/Documents ~/Library/Containers/com.coronalabs.osx.pewpew/Data/Library/Application Support/PewPew/tmp

The apparent repetition in the paths is due to the ability to build apps for either Mac App Store or self distribution.

For things like support emails, you can do quite a bit with mailto URLs on OS X, e.g.

system.openURL('mailto:corona@example.com?cc=bar@example.com&subject=Greetings%20from%20Palo%20Alto!&body=Corona%20SDK%20rules!')

will open a new message in Mail.app with everything filled in ready to send (I haven’t tried sending 20KB of text this way but you could experiment to determine the limits).

That is indeed a weird path but all seems to work here, that’s great!

I haven’t tried the mailto link yet, however I’d prefer not to use it simply because I’m assuming it’d only work on computers that have Mail.app set up? I personally don’t use Mail.app and I’m sure a lot others don’t either sadly.

Do you happen to know what the equivalent path is for Windows, or is that dependant on various factors like version?

Any mail application should handle mailto: URLs just fine.  

99% of non-programmers never change the defaults on their computer so (aside from those reading email in their browser) I would expect most Mac users to use Mail.app simply because it’s the default.

To find the location of any system path, just print it out:

print("system.DocumentsDirectory: ", system.pathForFile("", system.DocumentsDirectory))

That’s a good point actually, definitely something worth thinking about.

That’s great! for some reason I didn’t think pathForFile would give me a valid path. Really don’t know why though.