When I'm in the "emacs" editor on a file in a directory, and have made
changes to that file that I haven't saved, and then open up a window
on a file in another directory that happens to be a symbolic link to
the file I had already been editing, "emacs" can tell that I've opened
another window on the same file, and therefore brings up another copy
of the buffer that I'd edited complete with all my unsaved changes to
it.
Is there some way to tell this in Java in general? If I open one file
in a Java program, make changes to it, and then the user requests the
opening of a file with a different path name that happens to be the
same as the first file, can Java detect that it's the same file and
therefore not reopen it?
If anyone can point me to some information on this I'd greatly appre-
ciate it.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
Papastefanos Serafeim - 24 Jul 2006 17:38 GMT
Well, I believe that emacs is doing that by checking if the file
being opened is a symbolic link with an already opened file...
To do that in java, you can probably use the method
getCanonicalPath() of the File class.

Signature
Papastefanos Serafeim
serafeim@otenet.gr
> When I'm in the "emacs" editor on a file in a directory, and have made
> changes to that file that I haven't saved, and then open up a window
[quoted text clipped - 18 lines]
> if you don't believe there's a way."
> from _Why Not_
kvnsmnsn@hotmail.com - 24 Jul 2006 21:05 GMT
Papastefanos Serafeim posted:
=Well, I believe that emacs is doing that by checking if the file
=being opened is a symbolic link with an already opened file...
=
=To do that in java, you can probably use the method
=getCanonicalPath() of the File class.
Thanks! I was able to write a Java program using <getCanonicalPath()>
that recognized equivalences in files no matter what path name I spe-
cified.