Re: [JSch-users] Need a ChannelSftp.realPath() API
Status: Alpha
Brought to you by:
ymnk
|
From: <ym...@jc...> - 2008-01-24 03:25:51
|
Hi,
+-From: "Oberhuber, Martin" <Mar...@wi...> --
|_Date: Wed, 23 Jan 2008 23:07:38 +0100 _______________________
|
|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
Do you mean that 'baz.txt' is the canonical name of '/dir1/foo'?
What is the definition for the term 'canonical name'?
|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);
You can implement such a function by using
ChannelSftp#lstat(String aPath).
ChannelSftp#readlink(String aPath).
can't you?
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
|