How to handle "./", "~/" and related arguments in a CLI application

Viewed 101

I am creating a CLI application in Rust and would like to allow the user to run app ~/Desktop for example, in order to run the app in the user's Desktop directory. So, the question is if there is any shortcut to implementing arguments like this or would I have to implement my own system for parsing them, like a . argument setting the directory to Rust's current_dir() function, etc?

1 Answers

The shell will expand ~. Your application does not need to handle it.

. and .. are handled by the operating system. You also don't need to do anything special for them.

Related