Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFileManagerMBS class.

Previous items

NSFileManagerMBS.stringByDeletingPathExtension(path as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 16.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new string made by deleting the extension (if any, and only the last) from the receiver.

A new string made by deleting the extension (if any, and only the last) from the receiver. Strips any trailing path separator before checking for an extension. If the receiver represents the root path, it is returned unaltered.

The following table illustrates the effect of this method on a variety of different paths:

Receiver’s String ValueResulting String
“/tmp/scratch.tiff”“/tmp/scratch”
“/tmp/”“/tmp”
“scratch.bundle/”“scratch”
“scratch..tiff”“scratch.”
“.tiff”“.tiff”
“/”“/”

Note that attempting to delete an extension from ".tiff" causes the result to be @".tiff" instead of an empty string. This difference is because a file named ".tiff" is not considered to have an extension, so nothing is deleted. Note also that this method only works with file paths (not, for example, string representations of URLs).

NSFileManagerMBS.stringByExpandingTildeInPath(path as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 16.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new string made by expanding the initial component of the receiver to its full path value.

A new string made by expanding the initial component of the receiver, if it begins with “~” or “~user”, to its full path value. Returns a new string matching the receiver if the receiver’s initial component can’t be expanded.

Note that this method only works with file paths (not, for example, string representations of URLs).

NSFileManagerMBS.stringByResolvingSymlinksInPath(path as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 16.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new string made from the receiver by resolving all symbolic links and standardizing path.

A new string made by resolving all symbolic links, then removing extraneous path components. For absolute paths, all symbolic links are guaranteed to be removed. For relative paths, symbolic links that can’t be resolved are left unresolved in the returned string.

Returns self if an error occurs.

Note that this method only works with file paths (not, for example, string representations of URLs).

NSFileManagerMBS.stringByStandardizingPath(path as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 16.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new string made by removing extraneous path components from the receiver.

A new string made by performing the following operations:

  • Expanding an initial tilde expression using stringByExpandingTildeInPath.
  • Removing an initial component of “/private/var/automount”, “/var/automount”, or “/private” from the path, if the result still indicates an existing file or directory (checked by consulting the file system).
  • Reducing empty components and references to the current directory (that is, the sequences “//” and “/./”) to single path separators.
  • Removing a trailing slash from the last component.
  • For absolute paths only, resolving references to the parent directory (that is, the component “..”) to the real parent directory if possible using stringByResolvingSymlinksInPath. For relative paths, references to the parent directory are left in place.
  • Returns self if an error occurs.

Note that the path returned by this method may still have symbolic link components in it. Note also that this method only works with file paths (not, for example, string representations of URLs).

NSFileManagerMBS.URLByAppendingPathComponent(URL as string, pathComponent as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by appending a path component to the original URL.

pathComponent: The path component to add to the URL.

Returns a new URL with pathComponent appended.

If the original URL does not end with a forward slash and pathComponent does not begin with a forward slash, a forward slash is inserted between the two parts of the returned URL, unless the original URL is the empty string.

Available in Mac OS X v10.6 and later.

See also:

NSFileManagerMBS.URLByAppendingPathComponent(URL as string, pathComponent as string, isDirectory as boolean) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by appending a path component to the original URL, along with a trailing slash if the component is designated a directory.

pathComponent: The path component to add to the URL.
isDirectory: If true, a trailing slash is appended after pathComponent.
Returns a new URL with pathComponent appended.

If the original URL does not end with a forward slash and pathComponent does not begin with a forward slash, a forward slash is inserted between the two parts of the returned URL, unless the original URL is the empty string.

Available in Mac OS X v10.7 and later.

See also:

NSFileManagerMBS.URLByAppendingPathExtension(URL as string, pathExtension as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by appending a path extension to the original URL.

pathExtension: The path extension to add to the URL.

Returns a new URL with pathExtension appended.

If the original URL ends with one or more forward slashes, these are removed from the returned URL. A period is inserted between the two parts of the new URL.
Available in Mac OS X v10.6 and later.

NSFileManagerMBS.URLByDeletingLastPathComponent(URL as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by deleting the last path component from the original URL.

If the original URL represents the root path, the returned URL is identical. Otherwise, if the original URL has only one path component, the new URL is the empty string.
Available in Mac OS X v10.6 and later.

NSFileManagerMBS.URLByDeletingPathExtension(URL as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by deleting the path extension, if any, from the original URL.

If the original URL represents the root path, the returned URL is identical. If the URL has multiple path extensions, only the last one is removed.
Available in Mac OS X v10.6 and later.

NSFileManagerMBS.URLByResolvingSymlinksInPath(URL as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL that points to the same resource as the original URL and includes no symbolic links.

If the original URL has no symbolic links, the returned URL is identical to the original URL.

This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.

Available in Mac OS X v10.6 and later.

NSFileManagerMBS.URLByStandardizingPath(URL as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method iCloud MBS MacCocoa Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL that points to the same resource as the original URL and is an absolute path.

This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.

Available in Mac OS X v10.6 and later.

Previous items

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...