How can I open a file that is in a different directory?

I created a project via cargo, and i want to open file, that is in a different directory.

How can i do this, if i will use
let mut file = File::open("i don't know, what i have to write here").expect("Error to open");

This is not worked
let mut file = File::open("../some_file.txt").expect("Error to open");

When i create file i write:
File::open("src/some_file.txt");

And it worked. Thanks!

1 Like

Sorry I was confused! Cargo run actually runs the command in the current folder. But I'm glad it works now :wink: