How do I create a File from a string that may represent an absolute or a relative path?
<p>I have a directory pointed to by a File object called <em>baseDir</em> in which I keep most of my files.</p>

<p>I have a String <em>f</em> which may contain a relative filename, like "data.gz", or an absolute filename like "/mnt/data.gz" (its specified in a config file).</p>

<p>In the event that <em>f</em> is relative, it should be assumed that the file specified is within <em>baseDir</em>, but if it is absolute then it should be treated accordingly.</p>

<p>How do I create a File object that points to the file represented by <em>f</em>?</p>

<p>I can think of hacky solutions to this (eg. <code>if (f.startsWith("/")) ...</code> but I'm hoping there is a "right way" to do this.</p>

<p>Oh, I tried using the File(File, String) constructor for the File object, but it doesn't do what I need it to do.</p>
