mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复isDir判断改变pwd的问题
This commit is contained in:
@@ -73,7 +73,12 @@ public abstract class AbstractFtp implements Closeable {
|
|||||||
* @since 5.7.5
|
* @since 5.7.5
|
||||||
*/
|
*/
|
||||||
public boolean isDir(String dir) {
|
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));
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user