Validity of a path

  • The path of a file is initialized in a NSString.
    I want to know if this path is valid.
    I can try to open the file and test the return value to test the
    validity of this path but is there another method to know if this
    path is valid ?
    Thanks.

    Eric PETIT
  • On Jan 6, 2008 2:55 PM, Eric PETIT <epetit91...> wrote:

    > The path of a file is initialized in a NSString.
    > I want to know if this path is valid.
    > I can try to open the file and test the return value to test the
    > validity of this path but is there another method to know if this
    > path is valid ?

    NSFileManager has methods to check for various definitions of "valid":
    -fileExistsAtPath:, isReadableFileAtPath:, isWritableFileAtPath:, etc.

    sherm--
  • > I want to know if this path is valid.

      Read the documentation for NSFileManager ...

    --
    I.S.
  • Eric PETIT wrote:

    > The path of a file is initialized in a NSString.
    > I want to know if this path is valid.
    > I can try to open the file and test the return value to test the
    > validity of this path but is there another method to know if this
    > path is valid ?
    > Thanks.

    If you're looking to see if the string identifies a file that exists,
    NSFileManager offers fileExistsAtPath:.

    G
  • >
    >
    > The path of a file is initialized in a NSString.
    > I want to know if this path is valid.
    > I can try to open the file and test the return value to test the
    > validity of this path but is there another method to know if this
    > path is valid ?
    >
    Use ' fileExistsAtPath'  API of  NSFileManager.  I presume that by
    'valid' you mean
    that the file exists at the said path.

    Regards
    Shripada
previous month january 2008 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 31      
Go to today