"Operation could not be completed. No such file or directory"

  • Using NSFileManager I get the error messaged referenced in the Subject
    Line.

    But, which is it referring to ... the copyItemAtPath or the toPath

    bool rtx2 = [[NSFileManager defaultManager] copyItemAtPath:prefsrcpath
    toPath:prefdstpath error:&error];

    -koko
  • It's referring to the source path. The documentation specifically states that no file should exist at the destination path. So, one can deduce that NSFileManager wouldn't report a "no such file" error if there was no file there, since that is what is expected.

    -Kevin

    On Apr 13, 2010, at 11:31 AM, <koko...> wrote:

    > Using NSFileManager I get the error messaged referenced in the Subject Line.
    >
    > But, which is it referring to ... the copyItemAtPath or the toPath
    >
    > bool rtx2 = [[NSFileManager defaultManager] copyItemAtPath:prefsrcpath toPath:prefdstpath error:&error];
    >
    > -koko
  • Not true.  I did  bool exists = [[NSFileManager defaultManager]
    fileExistsAtPath:prefsrcpath];
    on the source path and it returned true.  I found the error though, my
    destination path was in error!

    -koko

    On Apr 13, 2010, at 12:43 PM, Kevin Perry wrote:

    > It's referring to the source path. The documentation specifically
    > states that no file should exist at the destination path. So, one
    > can deduce that NSFileManager wouldn't report a "no such file" error
    > if there was no file there, since that is what is expected.
    >
    > -Kevin
    >
    > On Apr 13, 2010, at 11:31 AM, <koko...> wrote:
    >
    >> Using NSFileManager I get the error messaged referenced in the
    >> Subject Line.
    >>
    >> But, which is it referring to ... the copyItemAtPath or the toPath
    >>
    >> bool rtx2 = [[NSFileManager defaultManager]
    >> copyItemAtPath:prefsrcpath toPath:prefdstpath error:&error];
    >>
    >> -koko
    >
    >
  • On Apr 13, 2010, at 11:31 AM, <koko...> wrote:

    > Using NSFileManager I get the error messaged referenced in the Subject Line.
    > But, which is it referring to ... the copyItemAtPath or the toPath

    Does the NSError’s info dict have a key that gives the offending path?
    (If not, it should — someone file an ER!)

    —Jens
  • On Apr 13, 2010, at 11:43 AM, Kevin Perry wrote:

    > It's referring to the source path. The documentation specifically states that no file should exist at the destination path. So, one can deduce that NSFileManager wouldn't report a "no such file" error if there was no file there

    It would, if a parent directory of the destination path were missing.

    —Jens
  • and yes, it was an error in the toPath, it was missing its first path
    component.

    And duh, the userInfo gives the offending path ..

    On Apr 13, 2010, at 12:55 PM, Jens Alfke wrote:

    >
    > On Apr 13, 2010, at 11:43 AM, Kevin Perry wrote:
    >
    >> It's referring to the source path. The documentation specifically
    >> states that no file should exist at the destination path. So, one
    >> can deduce that NSFileManager wouldn't report a "no such file"
    >> error if there was no file there
    >
    > It would, if a parent directory of the destination path were missing.
    >
    > —Jens
previous month april 2010 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today