Best way to find resources

What's the best way to find resources (for instance, a data file) from a binary so it works both with cargo run and as if it was in the src or src/bin dir? Can I use some special env or cargo bar to detect whether it's running in a target subdir?
I'm now hard coding a couple of relative dirs and try in order, but maybe there's a smarter way.

Something like std::env::current_exe or std::env::current_dir might be useful here.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.