Where to place json files your project depends upon?

I have a project that relies on a json file and I am wondering what the idiomatic place for that file is. I.e. where would one generally place resources that your project relies upon?

The project layout section of the Manifest Format does not mention anything on other resources.

1 Like

You want to know where to put resource files while developing and not when releasing, right?

I don't think there is an official place to put them. When I include files with include_bytes! or something like that, I tend to put the files in a subdirectory of src and make a mod.rs file that loads the files in const variables. Then I access the content of the files by using that module.

If you don't include them into your binary it may make more sense to separate them from the source code, and having a resources/ directory alongside src/ and co.

1 Like

Web projects usually have a resource folder.
If I remember correctly, it usually looks something like this:

project
 |
 |-- res(or resources)
 |
 |-- src
 |...
1 Like

funny thing is that if you build it with cargo build -p <project> from parent directory (umbrella type project), you get different working directory (of parent directory)

i had to add a check for res directory is actually being there

1 Like