Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSBundleMBS class.

NSBundleMBS.allBundles as NSBundleMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of all the application's non-framework bundles.
Example
dim a(-1) as NSBundleMBS = NSBundleMBS.allBundles
dim lines(-1) as string

for each n as NSBundleMBS in a
lines.Append n.bundlePath
next

MsgBox Join(lines,EndOfLine)

The returned array includes the main bundle and all bundles that have been dynamically created but doesn't contain any bundles that represent frameworks.

NSBundleMBS.allFrameworks as NSBundleMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of all of the application's bundles that represent frameworks.
Example
dim a(-1) as NSBundleMBS = NSBundleMBS.allFrameworks
dim lines(-1) as string

for each n as NSBundleMBS in a
lines.Append n.bundlePath
next

MsgBox Join(lines,EndOfLine)

Returns an array of all of the application's bundles that represent frameworks. Only frameworks with one or more Objective-C classes in them are included.

The returned array includes frameworks that are linked into an application when the application is built and bundles for frameworks that have been dynamically created.

NSBundleMBS.bundleWithIdentifier(identifier as string) as NSBundleMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the previously created NSBundle instance that has the specified bundle identifier.
Example
// create with path
dim x as NSBundleMBS = NSBundleMBS.bundleWithPath(SpecialFolder.Applications.Child("iTunes.app"))
MsgBox x.bundlePath

// once the bundle is known it will be in the allBundles array and be found with bundleWithIdentifier:
dim n as NSBundleMBS = NSBundleMBS.bundleWithIdentifier("com.apple.iTunes")
MsgBox n.bundlePath

The previously created NSBundle instance that has the bundle identifier identifier. Returns nil if the requested bundle is not found.

This method is typically used by frameworks and plug-ins to locate their own bundle at runtime. This method may be somewhat more efficient than trying to locate the bundle using the bundleForClass method.

NSBundleMBS.bundleWithPath(path as folderitem) as NSBundleMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an NSBundle object that corresponds to the specified directory.
Example
// create with path
dim x as NSBundleMBS = NSBundleMBS.bundleWithPath(SpecialFolder.Applications.Child("iTunes.app"))
MsgBox x.bundlePath

Returns the NSBundle object that corresponds to fullPath, or nil if fullPath does not identify an accessible bundle directory.

This method allocates and initializes the returned object if there is no existing NSBundle associated with fullPath, in which case it returns the existing object.

See also:

NSBundleMBS.bundleWithPath(path as string) as NSBundleMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an NSBundle object that corresponds to the specified directory.
Example
// create with path
dim x as NSBundleMBS = NSBundleMBS.bundleWithPath("/Applications/iTunes.app")
MsgBox x.bundlePath

Returns the NSBundle object that corresponds to fullPath, or nil if fullPath does not identify an accessible bundle directory.

This method allocates and initializes the returned object if there is no existing NSBundle associated with fullPath, in which case it returns the existing object.

See also:

NSBundleMBS.mainBundle as NSBundleMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 9.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the NSBundle object that corresponds to the directory where the current application executable is located.
Example
MsgBox NSBundleMBS.mainBundle.bundlePath

Returns the NSBundle object that corresponds to the directory where the application executable is located, or nil if a bundle object could not be created.

This method allocates and initializes a bundle object if one doesn't already exist. The new object corresponds to the directory where the application executable is located. Be sure to check the return value to make sure you have a valid bundle. This method may return a valid bundle object even for unbundled applications.
In general, the main bundle corresponds to an application file package or application wrapper: a directory that bears the name of the application and is marked by a ".app" extension.

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


The biggest plugin in space...