Skip to content

Commit

Permalink
Clarify resource path expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalossilva committed Apr 10, 2023
1 parent 35147bf commit 0cbd3d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ class Resource(path: String) {
}
```

The resource files themselves must be:
To setup resources correctly and avoid `FilNotFoundException` & co:

1. **Put them in the [resources folder](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html#org.gradle.api.tasks.SourceSet:resources) of a source set.** For example, `src/commonTest/resources/` or `src/jsTest/resources/`.
2. **Specify the path relative to the project's directory.** For example, `src/commonTest/resources/a-folder/a-file.txt`.

- **Located in the [resources folder](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSet.html#org.gradle.api.tasks.SourceSet:resources) of a source set.** For example, `src/commonTest/resources/` or `src/jsTest/resources/`.
- **Accessed using a path relative to the project's directory, such as `src/commonTest/resources/optional/folders/file.txt`.** This allows having resource files with the same name under difference resource folders.

With these in mind, you're ready to go.

Expand Down

0 comments on commit 0cbd3d9

Please sign in to comment.