mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -82,7 +82,12 @@ public abstract class AbstractFtp implements Closeable {
|
||||
public boolean exist(String path) {
|
||||
final String fileName = FileUtil.getName(path);
|
||||
final String dir = StrUtil.removeSuffix(path, fileName);
|
||||
final List<String> names = ls(dir);
|
||||
final List<String> names;
|
||||
try{
|
||||
names = ls(dir);
|
||||
} catch (FtpException ignore){
|
||||
return false;
|
||||
}
|
||||
return containsIgnoreCase(names, fileName);
|
||||
}
|
||||
|
||||
|
@@ -346,7 +346,7 @@ public class Ftp extends AbstractFtp {
|
||||
if (StrUtil.isNotBlank(path)) {
|
||||
pwd = pwd();
|
||||
if(false == cd(path)){
|
||||
throw new FtpException("Change dir to [{}] error, maybe path not exist!");
|
||||
throw new FtpException("Change dir to [{}] error, maybe path not exist!", path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public class Ftp extends AbstractFtp {
|
||||
final String fileName = FileUtil.getName(path);
|
||||
final String dir = StrUtil.removeSuffix(path, fileName);
|
||||
if(false == cd(dir)){
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!");
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!", path);
|
||||
}
|
||||
|
||||
boolean isSuccess;
|
||||
@@ -528,7 +528,7 @@ public class Ftp extends AbstractFtp {
|
||||
if (StrUtil.isNotBlank(path)) {
|
||||
mkDirs(path);
|
||||
if (false == cd(path)) {
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!");
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!", path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ public class Ftp extends AbstractFtp {
|
||||
}
|
||||
|
||||
if(false == cd(path)){
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!");
|
||||
throw new FtpException("Change dir to [{}] error, maybe dir not exist!", path);
|
||||
}
|
||||
|
||||
if (null != fileNameCharset) {
|
||||
|
Reference in New Issue
Block a user