Crayon

AboutTutorialsDocumentationDemosDownloadSource

Resources

Library for accessing embedded resources.

function directoryExists(directoryPath)[link]

Checks to see if a directory exists. Note that directories only exist in resources if there are files contained in them. Directories present in the original source directory are not transferred to the final embedded resources.

Arguments

NameTypeDescription
directoryPath string

path to a resource directory.

Return Value

TypeDescription
boolean

true if the directory exists.

function directoryList(directoryPath, includeFullPath)[link]

Returns a list of file resources that are present in the given resource directory.

Arguments

NameTypeOptionalDescription
directoryPath string

path to a resource directory.

includeFullPath boolean Optional

if true, the full resource path will be included in the result.

Return Value

TypeDescription
List of strings

List of file resources available in that directory.

function fileExists(resourcePath)[link]

Checks to see if a file path exists in embedded resources.

Arguments

NameTypeDescription
resourcePath string

path to the resource from the root of the source directory.

Return Value

TypeDescription
boolean

True if the resource exists.

function readText(resourcePath)[link]

Reads a text file from embedded resources.

Arguments

NameTypeDescription
resourcePath string

path to the resource from the root of the source directory.

Return Value

TypeDescription
string

Text content of the file.