Bundle

description

This class lets you find files inside your application bundle.  There is only one global instance of this class and it applies to the current application’s bundle.

example

var imageFileName = Bundle.pathForResource( "images/cool.png")

May return “/Applications/myapp.app/images/cool.png”

Summary
This class lets you find files inside your application bundle.
Returns the full path to your bundle.
Returns the full path to a resource (file) inside your bundle if it exists.
Same as pathForResource above, but allows you to specify the directory separately from the resource name.

Properties

bundlePath

string bundlePath readonly

Returns the full path to your bundle.  For example “/Applications/myapp.app”.

Functions

pathForResource

string pathForResource(string resource)

Returns the full path to a resource (file) inside your bundle if it exists.  For example, if you specify “images/cool.png” and such a file exists in your bundle, this function will return “/Applications/myapp.app/images/cool.png”.

parameters

resourceThe name of the resource.

returns

stringAbsolute path to the resource.
nullIf the resource does not exist.

pathForResourceInDirectory

string pathForResourceInDirectory(string directory ,
string resource)

Same as pathForResource above, but allows you to specify the directory separately from the resource name.

parameters

directoryThe directory where the resources is expected to be located.
resourceThe name of the resource.

returns

stringAbsolute path to the resource
nullIf the resource does not exist.
string bundlePath readonly
Returns the full path to your bundle.
string pathForResource(string resource)
Returns the full path to a resource (file) inside your bundle if it exists.
string pathForResourceInDirectory(string directory ,
string resource)
Same as pathForResource above, but allows you to specify the directory separately from the resource name.