mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
修复isDir判断改变pwd的问题
This commit is contained in:
parent
b1642d4625
commit
4852d67bed
@ -73,7 +73,12 @@ public abstract class AbstractFtp implements Closeable {
|
||||
* @since 5.7.5
|
||||
*/
|
||||
public boolean isDir(String dir) {
|
||||
return cd(dir);
|
||||
final String workDir = pwd();
|
||||
try {
|
||||
return cd(dir);
|
||||
} finally {
|
||||
cd(workDir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,4 +90,14 @@ public class FtpTest {
|
||||
FileUtil.file("d:/test/download/" + name));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void isDirTest() throws Exception {
|
||||
try (Ftp ftp = new Ftp("127.0.0.1", 21)) {
|
||||
Console.log(ftp.pwd());
|
||||
ftp.isDir("/test");
|
||||
Console.log(ftp.pwd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user