Sftp has the ability to resolve the real (canonical) path
of remote files, in order to resolve symbolic links.
This can be used to follow a symbolic link for a directory:
ChannelSftp chan = (ChannelSftp)session.openChannel("sftp");
chan.cd("/alias/dir");
String realDir = chan.pwd();
It would be nice to also have that feature available for
resolving the canonical path of files, which may be accessed
through a chain of symbolic links. For instance:
/dir1/foo --> /dir2/foo --> bar --> baz.txt
in this case, I'd like to get
ChannelSftp chan = (ChannelSftp)session.openChannel("sftp");
// prints "/dir2/foo"
System.out.println(chan.readlink("/dir1/foo");
// should print "/dir2/baz.txt"
System.out.println(chan.realpath("/dir1/foo");
Without this additional API, the Sftp capability of realpath
can not be fully exploited and obtaining the canonical path
for a file may require followign multiple symbolic links,
thus requiring multiple server round trips.
Proposed API is
String ChannelSftp.realpath(String aPath);
Thoughts?
Thanks,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users