Force relative paths
Hi in my program there is an option to enter a directory as a command line argument. Is there any check I can perform to see whether this directory is relative to the current working directory?
For example if we are /home/user and the user wants to input /home/user/folder they have to type ./folder.
I need this to keep folder structure. Failing this is there anyway which I can compare two strings to produce the relative paths.
For example I will always have the current working directory in absolute stored in 'cwd' and I will also have the absolute path of the user entered directory stored in 'folder'
Can I compare the two and produce a relative path of 'folder' from 'cwd'?
Thanks for your help
Edit: This program is intended for Ubuntu Linux btw
Absolute paths start with /
Relative paths don't.
Cheers. Never even thought about that, been racking my brain for ages.