Problems opening files via shortcuts on windows

J

Jim Showalter

Hello,

Here is the problem. Assume that 'c:\link' is a shortcut to the directory
'c:\foo\bar\dir' and that the latter contains the file info.txt.

The following prints false

File f = new File("c:\link\info.txt");
System.out.println(f.canRead());

while this prints true

File f = new File("c:\foo\bar\dir\info.txt");
System.out.println(f.canRead());

Thus, links don't appear to be followed in Windows (the above returns true
for both cases on Solaris). Any suggestions on how to resolve the shortcut
to the proper target? I have had no success with any of the *path* methods
in the File class.

Thanks,
Jim
 
J

Joshua Cranmer

Jim said:
Hello,

Here is the problem. Assume that 'c:\link' is a shortcut to the directory
'c:\foo\bar\dir' and that the latter contains the file info.txt.

How is "C:\link" a shortcut? Is it the NTFS's linking support, or is it
a Windows shortcut? If it's the latter, then C:\link is nothing more
than a file saying (in essence) "C:\foo\bar\dir", and is seen as a file
by anyone who uses systems tools to open it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top