Strings and paths

As Jonathan Steele points out, these are all gone now:

Removed String.fileSystemRepresentation() -> [CChar]
Removed String.getFileSystemRepresentation(_: [CChar], maxLength: Int) -> Bool
Removed String.lastPathComponent
Removed String.pathComponents
Removed String.pathExtension
Removed String.pathWithComponents(_: [String]) -> String [static]
Removed String.stringByAbbreviatingWithTildeInPath
Removed String.stringByAppendingPathComponent(_: String) -> String
Removed String.stringByAppendingPathExtension(_: String) -> String?
Removed String.stringByDeletingLastPathComponent
Removed String.stringByDeletingPathExtension
Removed String.stringByExpandingTildeInPath
Removed String.stringByResolvingSymlinksInPath
Removed String.stringByStandardizingPath
Removed String.stringsByAppendingPaths(_: [String]) -> [String]
Easy enough to add
extension String { var ns : NSString {return self as NSString}}

and use it to force Foundation

"/Users/ericasadun/Desktop/initAllTheThings.txt".ns.lastPathComponent

4 Comments

  • Ah, but the question is, “Why?” Intentional or oversight? Nothing in the notes… Lots of threads on this in the forums, no one from Apple has chimed in yet

  • Where is the link: “Jonathan Steele points out”

    • No link. It’s a comment on the Beta 5 post

  • my guess is that they want to force people to use NSURL.URLByAppendingPathComponent() etc., since URLs are a more “correct” way of representing file paths.