User supplied file names must be either absolute or relative to the application. If the file starts with '/' then it must be absolute. Otherwise, it is relative. Just tack it on to the end of the current working directory name, then collapse instances of "./" and "../".
You didn't say whether you are working on Unix or Windows, so you should be able to handle paths that start with a drive letter ("D:/foo/bar" is absolute, but "D:foo/bar" is relative) and that use '\\' and/or '/' as separators.
Personally, I would be inclined to split the path into a deque, manipulate its parts, then join it back together when done.
Hope this helps.
Reputation Points: 1140
Solved Threads: 229
Postaholic
Offline 2,039 posts
since Oct 2007