Skip to content

Commit

Permalink
GITBOOK-202: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
bsutton authored and gitbook-bot committed Dec 10, 2023
1 parent 415e2f4 commit ed9b579
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions doc/dcli-api/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ As part of the packing process DCli also creates a registry of the packed resour

`<project root>/lib/src/dcli/resource/generated/resource_registry.g.dart`

Each of the packed resource is listed in the register with as a map with the 'mount point' as the key.
Each of the packed resources is listed in the register as a map with the 'mount point' as the key.

The `mount point` is the path of the packed resource relative to the `<project root>/resource` directory.

For external resources you specify a mount point to the project's resource directory that must not collide with any actual resource names under the \<project root>/resource directory.
For external resources, you specify a mount point to the project's resource directory that must not collide with any actual resource names under the \<project root>/resource directory.

The contents of the 'resource\_registry.dart' are of the form.

Expand Down Expand Up @@ -134,7 +134,7 @@ class ResourceRegistry {

## Unpacking resources

DCli provides an api that allows your script to unpack its resources at run time.
DCli provides an API that allows your script to unpack its resources at run time.

```
ResourceRegistry().resources['<relative filename>'].unpack(String localPath)
Expand Down Expand Up @@ -177,6 +177,18 @@ if (calculateHash(pathToResource).hexEncode() != packResource.checksum)
}
```

## Unpack all resources

You can unpack all resources by interating over the resource values:

````dart
```dart
for (final resource in ResourceRegistry.resources.values) {
resource.unpack(join(localTargetPath, resource.originalPath));
}
```
````

## External Resources

You can also pack resources that are external to your project by creating a pack.yaml file under your project's tool/dcli directory.
Expand Down

0 comments on commit ed9b579

Please sign in to comment.