How to get directory

I have following folder structure
-app
–api
—service
—templates

how can I get files from templates inside the service folder, In one function I have to provide a path to the file inside templates but when I do something like this inside service folder

"../templates/" it does not work

Remember the cwd. Also how are you planning to distribute the executable? It might be that cwd is unrelated to your source folder layout then.

You probably need to store assets somewhere and use configuration/xdg basedir specs to find it.

1 Like

Also, if it’s imports you’re taking about, use the full package names (import “github.com/example/repo/app/api/templates”).

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.