PackageManager.getOrLoadPackage

For a given package path, returns the corresponding package.

If the package is already loaded, a reference is returned. Otherwise the package gets loaded and cached for the next call to this function.

class PackageManager
getOrLoadPackage
(
NativePath path
,
NativePath recipe_path = NativePath.init
,
bool allow_sub_packages = false
,
StrictMode mode = StrictMode.Ignore
)

Parameters

path NativePath

NativePath to the root directory of the package

recipe_path NativePath

Optional path to the recipe file of the package

allow_sub_packages bool

Also return a sub package if it resides in the given folder

mode StrictMode

Whether to issue errors, warning, or ignore unknown keys in dub.json

Return Value

Type: Package

The packages loaded from the given path

Throws

Throws an exception if no package can be loaded

Meta