title: NSFilemanager attributesOfItemAtPath frustrations
body: <p>I'm using a bit of code that a user posted here modified for my settings to do a file copy with a progress bar (from Cocoa is my Girlfriend <a href="http://www.cimgf.com/2008/05/03/cocoa-tutorial-file-copy-with-progress-indicator/" rel="nofollow">http://www.cimgf.com/2008/05/03/cocoa-tutorial-file-copy-with-progress-indicator/</a> ). </p>
  
  <p>I have attempted to fix some of the use of deprecated methods and in the process have broken detecting file size. I spent most of the day yesterday trying different things to fix it but haven't had any luck. I should also note that sourceFilePath is obtained from a NSTextField.</p>
  
  <p>I know the error message says the file doesn't exist but it certainly does. It's path doesn't contain any sym links and to be sure I used the NSString method stringByResolvingSymlinksInPath. Any ideas what's going wrong here? Here's the code, and the error message I get.</p>
  
  <pre><code>- (IBAction)startCopy:(id)sender;
  {
  NSError *attributeserror = nil;
  
  NSString *accountsourcestring = [sourceFilePath stringValue];
  NSString *accountsourcestringpath =[accountsourcestring stringByStandardizingPath];
  
  // Use the NSFileManager to obtain the size of our source file in bytes.
  NSFileManager *fileManager = [NSFileManager defaultManager];
  NSDictionary *sourceAttributes = [fileManager     attributesOfItemAtPath:accountsourcestringpath error:&amp;attributeserror];
  NSNumber *sourceFileSize= [sourceAttributes objectForKey:NSFileSize];
  long long fileSize = [sourceFileSize longLongValue];
  
  NSLog(@"Filesize = %lld", fileSize);
  NSLog(@"sourcefilepath: %@", accountsourcestring);
  
  if ((sourceFileSize = [sourceAttributes objectForKey:NSFileSize]) )
  {
      // Set the max value to our source file size
      [progressIndicator setMaxValue:(double)[sourceFileSize unsignedLongLongValue]];
  }
      else
  {
      // Couldn't get the file size so we need to bail.
      NSLog(@"Unable to obtain size of file being copied. Error %@ Source file size: %@,   sourceAttributes: %@", attributeserror, sourceFileSize, sourceAttributes);
      return;
  }
  </code></pre>
  
  <p>And here's the error message logged in console:</p>
  
  <pre><code>2012-09-01 11:23:07.061 Copy File[1004:303] Filesize = 0
  2012-09-01 11:23:07.062 Copy File[1004:303] sourcefilepath:     file://localhost/Users/daniel/Lion%20plists/
  2012-09-01 11:23:07.072 Copy File[1004:303] Unable to obtain size of file being copied.    Error Error Domain=NSCocoaErrorDomain Code=260 "The file “Lion%20plists” couldn’t be opened   because there is no such file." UserInfo=0x100173770   {NSFilePath=file:/localhost/Users/daniel/Lion%20plists, NSUnderlyingError=0x100140240 "The   operation couldn’t be completed. No such file or directory"} Source file size: (null),   sourceAttributes: (null)
  </code></pre>