[jcifs] detecting imported shares
simon at gornall.net
Sun Mar 3 11:21:25 EST 2002
Michael B Allen wrote:
> 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.
It's just that I'm getting drag'n'drop events from the filesystem, and
data flavour from the Win32 desktop uses drive: semantics :-( I'm
using the UNC stuff everywhere internally, but I need to convert what
passed by the 'drop' event.
I'll look into the fileroots idea - it may be useful :-) The "net use"
seems to give me what I want, but it's a bit inelegant ... I'd prefer
a java-only approach if it were available. I'm just like that :-)
More information about the jcifs