[jcifs] Equivalent for java.io.File.getCanonicalPath()

Michael B Allen mba2000 at ioplex.com
Fri Jan 30 20:40:23 GMT 2004


Julian Reschke said:
> Hi,
>
> I'm looking for a jcifs equivalent of java.io.File.getCanonicalPath().
> Note that SmbFile.getCanonicalPath() does *not* do the same.
>
> For instance, given a filename "a" on an NTFS filesystem,
> java.io.File.getCanonicalPath() will return "a" for each of
>
> (new File("A")).getCanonicalPath()
> (new File("a")).getCanonicalPath()

It changes the case?!

> (new File("A ")).getCanonicalPath()

Trimming leading and trailing space is no problem. I'll fix that. I didn't
know it was a problem.

> and so on... (alternatively I'd need a way to find out whether two
> distinct SmbFile objects refer to the same file on the remote filesystem).

That's precisely what SmbFile.equals() is supposed to do. If it doesn't
it's a bug and please let me know.

Mike


More information about the jcifs mailing list