• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Moving Files From /private/tmp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Moving Files From /private/tmp


  • Subject: Moving Files From /private/tmp
  • From: Oliver Cameron <email@hidden>
  • Date: Tue, 29 Mar 2005 22:28:03 +0100

I'm having some trouble using the NSFileManager method movePath:toPath:handler. Basically, what I want to do is place a png file inside a folder I create in /private/tmp, then later retrieve this file and overwrite a file with the same filename somewhere in the Users folder. This is my code to do this:

NSString *privateString = @"/private/tmp/My Folder/";
NSString *privateFullString = [privateString stringByAppendingPathComponent:[file lastPathComponent]];
[[NSFileManager defaultManager] movePath:privateFullString toPath:[NSHomeDirectory() stringByAppendingPathComponent:@"FolderWhereFileWithSameFileNameIs"] handler:nil];


When I NSLog(privateFullString), I get the correct file path. And I checked /private/tmp and my file is correctly getting added to it, but when I try and move it (via the code above), nothing happens.

So I checked what movePath:toPath:handler: returned (a BOOL) and it returned NO, so something was going wrong. My suspicion is permissions, but I have no other place in which I can move these files (due to a restrictive plist), so I can't use NSTemporaryThingy() and I'd rather not have the user need admin access.

So as a last attempt I tried using NSData, and got the contents of the file in /private/tmp with a +dataWithContentsOfFile call, I then used writeToFile:atomically and checked its BOOL, it was also returning no and didn't work. So I'm pretty much out of ideas, anything at all is useful.

Thanks,
Oliver

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Moving Files From /private/tmp
      • From: "Sean McBride" <email@hidden>
    • Re: Moving Files From /private/tmp
      • From: Ondra Cada <email@hidden>
    • Re: Moving Files From /private/tmp
      • From: Justin Spahr-Summers <email@hidden>
  • Prev by Date: Up arrow in NSTextView
  • Next by Date: Re: Up arrow in NSTextView
  • Previous by thread: Re: Up arrow in NSTextView
  • Next by thread: Re: Moving Files From /private/tmp
  • Index(es):
    • Date
    • Thread