File not found in Umbrella project

hey so I’ve got an umbrella project in which one of the apps (in apps folder) has a file in a data directory that I created (let’s call it /data/sample_data.txt.).
It is on the same level in the hierarchy as lib, config, and test. I am using this file inside one of the application’s modules.

Now I want to run tests for all the applications in the Umbrella project by doing mix test at the top level directory, as opposed to inside of the specific application’s directory.

When I run mix test within that application everything works fine but if I go to the umbrella project’s top level directory and try to run all tests it says that it cannot find that file. It seems like I should be able to run all tests for all applications within the umbrella folder, am I mistaken here? Where should this file live and/or is there a convention that I should be following?

Thank you

:wave:

How do you specify the path to the file?

1 Like

Hi @blksheephw,

You can either use absolute path or use Application.app_dir(app_name) to get the app directory and append your path or put it in the priv directory of your application and use :code.priv_dir(app_name) and append your path.

When you release your app, you have to manually specify the path to copy your file if you don’t use priv directory.

Thanks.

3 Likes

i’m using it as a constant with a module attribute like this @data_file "data/sample_data.txt"

from a module in the lib directory

thank you

Then when running the test from umbrella root, it would look at <umbrella_root>/data/sample.txt.