>Why should Mail "obviously should have access to this directory”?
Because Mail stores attachments to that folder. >You’re not consulting/logging the error message for a start . That will tell you *why* it fails There's not much to log. The path to a file i generate is (i - is a number): NSString *emlFilePath = [TempDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.eml", i, nil]]; empFilePath (disregarding ability to save file to that directory) contains some sandbox-like bath (i.e., it's not a "straight" path to ~Downloads, but rather a symlink through /private/var Then I'm calling [[[[[Message saver] alloc] init] autorelease] saveMessagesWithoutPrompting:wrappedMessage toFilePath:emlFilePath headerDetailLevel:1 format:0]; This function does not return any error status. It works on Mail on OS X 10.6, and on my machine on OS X 10.8. It doesn't work on my client's 10.8 though. I was wondering if I am breaking some sandboxing rules that may forbid apps to do what I am doing, when the system has higher security settings that my system, that's all. Because on my 10.8.2 with latest update of Mail.app it works fine, on client's machine (with latest update either!) it doesn't - the .eml files do not get created, and the only error I am getting is that .eml file is not found (when I try to access the file later). 2013/2/22 Mike Abdullah <cocoa...@mikeabdullah.net> > > On 22 Feb 2013, at 01:34, Nick wrote: > > > Hello. > > I am working on a plugin for Mail.app for Mountain Lion. The problem is > > whenever I try to save a file, I am getting an error. Which can be > > explained by the fact that Mail.app is sandboxed and I am not allowed to > > modify files anywhere on the system. > > So what I do instead - is call > > > > > > TempDir = [[[NSFileManager defaultManager] URLForDirectory: > > NSDownloadsDirectory inDomain:NSUserDomainMask appropriateForURL:nil > create: > > YES error:nil] path]; > > > > > > and then create in this TempDir another directory using standard > > NSFileManager functions. > > On my Mail.app it works, on another system - it doesn't (the dir doesn't > > get created). I can't understand why. I was hoping to store a temporary > > file in Downloads, since Mail obviously should have access to this > > directory. > > Why should Mail "obviously should have access to this directory”? > > > > I also tried calling this > > > > TempDir = [[[[NSFileManager defaultManager] > > URLForDirectory:NSItemReplacementDirectory inDomain:NSUserDomainMask > > appropriateForURL:[NSURL URLWithString: > > @"file:///private/var/tmp/my.great.app"] create:YES error:nil] path] > > retain]; > > > > > > On my 10.8 system it works, on another - it doesn't (I can't save files > to > > TempDir from my plugin). What am I doing wrong? > > You’re not consulting/logging the error message for a start . That will > tell you *why* it fails. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com