On Oct 29, 2008, at 6:01 AM, Daniel Luis dos Santos wrote:

Hello,

Are there in the Foundation framework (or anywhere else on the Cocoa platform) path handling routines (directory extraction, path decomposition) ?


NSString has several methods for extracting the basename, directory name, extension etc.

        • + pathWithComponents:
        • – pathComponents
        • – completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:
        • – fileSystemRepresentation
        • – getFileSystemRepresentation:maxLength:
        • – isAbsolutePath
        • – lastPathComponent
        • – pathExtension
        • – stringByAbbreviatingWithTildeInPath
        • – stringByAppendingPathComponent:
        • – stringByAppendingPathExtension:
        • – stringByDeletingLastPathComponent
        • – stringByDeletingPathExtension
        • – stringByExpandingTildeInPath
        • – stringByResolvingSymlinksInPath
        • – stringByStandardizingPath
        • – stringsByAppendingPaths:

The safest way of turning argv[i] into an NSString is with NSFileManager, thus:

NSString *path = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:argv[i] length:strlen(argv[i])];


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to