Suggest NSURL path methods instead of NSString

rdar://problem/22095657

Swift SVN r30978
This commit is contained in:
David Farler
2015-08-04 02:59:41 +00:00
parent 03e3dc2e2d
commit 8febbc1095

View File

@@ -172,7 +172,7 @@ extension String {
/// Returns a string built from the strings in a given array
/// by concatenating them with a path separator between each pair.
@available(*, unavailable, message="Use pathWithComponents on NSString instead.")
@available(*, unavailable, message="Use fileURLWithPathComponents on NSURL instead.")
public static func pathWithComponents(components: [String]) -> String {
return NSString.pathWithComponents(components)
}
@@ -611,7 +611,7 @@ extension String {
// - (const char *)fileSystemRepresentation
/// Returns a file system-specific representation of the `String`.
@available(*, unavailable, message="Use fileSystemRepresentation on NSString instead.")
@available(*, unavailable, message="Use getFileSystemRepresentation on NSURL instead.")
public func fileSystemRepresentation() -> [CChar] {
return _persistCString(_ns.fileSystemRepresentation)!
}
@@ -674,7 +674,7 @@ extension String {
/// fills a buffer with a C-string in a format and encoding suitable
/// for use with file-system calls.
/// - Note: will store a maximum of `min(buffer.count, maxLength)` bytes.
@available(*, unavailable, message="Use getFileSystemRepresentation on NSString instead.")
@available(*, unavailable, message="Use getFileSystemRepresentation on NSURL instead.")
public func getFileSystemRepresentation(
inout buffer: [CChar], maxLength: Int) -> Bool {
return _ns.getFileSystemRepresentation(
@@ -922,7 +922,7 @@ extension String {
// @property NSString lastPathComponent;
/// Returns the last path component of the `String`.
@available(*, unavailable, message="Use lastPathComponent on NSString instead.")
@available(*, unavailable, message="Use lastPathComponent on NSURL instead.")
public var lastPathComponent: String {
return _ns.lastPathComponent
}
@@ -1051,7 +1051,7 @@ extension String {
/// Returns an array of NSString objects containing, in
/// order, each path component of the `String`.
@available(*, unavailable, message="Use pathComponents on NSString instead.")
@available(*, unavailable, message="Use pathComponents on NSURL instead.")
public var pathComponents: [String] {
return _ns.pathComponents
}
@@ -1060,7 +1060,7 @@ extension String {
/// Interprets the `String` as a path and returns the
/// `String`s extension, if any.
@available(*, unavailable, message="Use pathExtension on NSString instead.")
@available(*, unavailable, message="Use pathExtension on NSURL instead.")
public var pathExtension: String {
return _ns.pathExtension
}
@@ -1286,7 +1286,7 @@ extension String {
// - (NSString *)stringByAppendingPathComponent:(NSString *)aString
/// Returns a new string made by appending to the `String` a given string.
@available(*, unavailable, message="Use stringByAppendingPathComponent on NSString instead.")
@available(*, unavailable, message="Use URLByAppendingPathComponent on NSURL instead.")
public func stringByAppendingPathComponent(aString: String) -> String {
return _ns.stringByAppendingPathComponent(aString)
}
@@ -1295,7 +1295,7 @@ extension String {
/// Returns a new string made by appending to the `String` an
/// extension separator followed by a given extension.
@available(*, unavailable, message="Use stringByAppendingPathExtension on NSString instead.")
@available(*, unavailable, message="Use URLByAppendingPathExtension on NSURL instead.")
public func stringByAppendingPathExtension(ext: String) -> String? {
// FIXME: This method can return nil in practice, for example when self is
// an empty string. OTOH, this is not documented, documentatios says that
@@ -1319,7 +1319,7 @@ extension String {
/// Returns a new string made by deleting the last path
/// component from the `String`, along with any final path
/// separator.
@available(*, unavailable, message="Use stringByDeletingLastPathComponent on NSString instead.")
@available(*, unavailable, message="Use URLByDeletingLastPathComponent on NSURL instead.")
public var stringByDeletingLastPathComponent: String {
return _ns.stringByDeletingLastPathComponent
}
@@ -1328,7 +1328,7 @@ extension String {
/// Returns a new string made by deleting the extension (if
/// any, and only the last) from the `String`.
@available(*, unavailable, message="Use stringByDeletingPathExtension on NSString instead.")
@available(*, unavailable, message="Use URLByDeletingPathExtension on NSURL instead.")
public var stringByDeletingPathExtension: String {
return _ns.stringByDeletingPathExtension
}
@@ -1435,7 +1435,7 @@ extension String {
/// Returns a new string made from the `String` by resolving
/// all symbolic links and standardizing path.
@available(*, unavailable, message="Use stringByResolvingSymlinksInPath on NSString instead.")
@available(*, unavailable, message="Use URLByResolvingSymlinksInPath on NSURL instead.")
public var stringByResolvingSymlinksInPath: String {
return _ns.stringByResolvingSymlinksInPath
}
@@ -1444,7 +1444,7 @@ extension String {
/// Returns a new string made by removing extraneous path
/// components from the `String`.
@available(*, unavailable, message="Use stringByStandardizingPath on NSString instead.")
@available(*, unavailable, message="Use URLByStandardizingPath on NSURL instead.")
public var stringByStandardizingPath: String {
return _ns.stringByStandardizingPath
}
@@ -1461,7 +1461,7 @@ extension String {
/// Returns an array of strings made by separately appending
/// to the `String` each string in in a given array.
@available(*, unavailable, message="Use stringsByAppendingPaths on NSString instead.")
@available(*, unavailable, message="map over paths with URLByAppendingPathComponent instead.")
public func stringsByAppendingPaths(paths: [String]) -> [String] {
return _ns.stringsByAppendingPaths(paths)
}