[jcifs] detecting imported shares

Michael B Allen mballen at erols.com
Sun Mar 3 09:37:37 EST 2002

On Sat, 02 Mar 2002 21:43:47 +0000
Simon Gornall <simon at gornall.net> wrote:

> > > Hi all,
> > >
> > > Is it possible using JCIFS to map a name like 'E:\path\to\file' to
> > > '//machine/share/path/to/file', assuming that E: is a drive that's been
> > > network-mapped ?
> > 
> > You mean DFS? No. That requires additional network processing that will
> > probably not be implemented (by me) for some time. It wasn't even in
> > todo.txt but I'll add it.
> I don't think I mean DFS :-) 
> All I want to do is work out the UNC filename from the drive: format.
> For the time being, I'm going to detect if I'm running on a windows box 
> then do a System.exec("net use"); which will give me enough to work out
> the mapping. Not elegant, but it'll work :-)

Ahh, I see. Would java.io.File.listRoots() help? Probably not. I suppose
you will indeed have to exec net use or do a dab of JNI. You know you can
use unc paths directly with java.io.File right? Maybe you should normalize
on that and then you don't have to worry about lettered drives? But
I suppose if you free yourself from the dependency on lettered drives
then you could just commit to jCIFS entirely so I gather you need the
letters for something else.


May The Source be with you.

More information about the jcifs mailing list