[bug #51592] -[NSFileManager copyItemAtPath:toPath:error:] should not raise exceptions

Larry Campbell <[email protected]>
Newsgroups gmane.comp.lib.gnustep.bugs
Message-ID <[email protected]>
URL:
  <http://savannah.gnu.org/bugs/?51592>

                 Summary: -[NSFileManager copyItemAtPath:toPath:error:] should
not raise exceptions
                 Project: GNUstep
            Submitted by: lcampbel
            Submitted on: Thu 27 Jul 2017 03:30:08 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

At the top of _copyFile:toFile:handler:, we have this:

  /* Assumes source is a file and exists! */
  NSAssert1 ([self fileExistsAtPath: source],
    @"source file '%@' does not exist!", source);

  attributes = [self fileAttributesAtPath: source traverseLink: NO];
  NSAssert1 (attributes, @"could not get the attributes for file '%@'",
    source);

However, any other error causes the handler (if any) to be called and NO to be
returned. I think these asserts should be replaced by something like:

if (!exists)
      return [self _proceedAccordingToHandler: handler
                                     forError: @"source file does not exist"
                                       inPath: source
                                     fromPath: source
                                       toPath: destination];





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51592>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.