mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
handle "/" in exist
This commit is contained in:
parent
a46be0ca56
commit
89b2ef8d05
|
@ -128,7 +128,14 @@ public class FilerClient extends FilerGrpcClient {
|
||||||
|
|
||||||
public boolean exists(String path){
|
public boolean exists(String path){
|
||||||
File pathFile = new File(path);
|
File pathFile = new File(path);
|
||||||
return lookupEntry(pathFile.getParent(), pathFile.getName()) != null;
|
String parent = pathFile.getParent();
|
||||||
|
String entryName = pathFile.getName();
|
||||||
|
if(parent == null) {
|
||||||
|
parent = path;
|
||||||
|
entryName ="";
|
||||||
|
}
|
||||||
|
return lookupEntry(parent, entryName) != null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean rm(String path, boolean isRecursive, boolean ignoreRecusiveError) {
|
public boolean rm(String path, boolean isRecursive, boolean ignoreRecusiveError) {
|
||||||
|
|
|
@ -25,5 +25,8 @@ public class SeaweedFilerTest {
|
||||||
if(filerClient.exists("/new_folder/new_empty_file")){
|
if(filerClient.exists("/new_folder/new_empty_file")){
|
||||||
System.out.println("/new_folder/new_empty_file should not exists");
|
System.out.println("/new_folder/new_empty_file should not exists");
|
||||||
}
|
}
|
||||||
|
if(!filerClient.exists("/")){
|
||||||
|
System.out.println("/ should exists");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue