get file with permission

This commit is contained in:
Dongdong Zhou 2021-10-18 14:26:57 +01:00
parent a6431cb75b
commit 8ac6f6b909
1 changed files with 21 additions and 14 deletions

View File

@ -575,24 +575,31 @@ fn handle_request(&self, id: RequestId, rpc: Request) {
let mut dirs = Vec::new(); let mut dirs = Vec::new();
dirs.push(workspace.clone()); dirs.push(workspace.clone());
while let Some(dir) = dirs.pop() { while let Some(dir) = dirs.pop() {
for entry in fs::read_dir(dir).unwrap() { if let Ok(readdir) = fs::read_dir(dir) {
let entry = entry.unwrap(); for entry in readdir {
let path = entry.path(); let entry = entry.unwrap();
if entry.file_name().to_str().unwrap().starts_with(".") { let path = entry.path();
continue; if entry
} .file_name()
if path.is_dir() {
if !path
.as_path()
.to_str() .to_str()
.unwrap() .unwrap()
.to_string() .starts_with(".")
.ends_with("target")
{ {
dirs.push(path); continue;
}
if path.is_dir() {
if !path
.as_path()
.to_str()
.unwrap()
.to_string()
.ends_with("target")
{
dirs.push(path);
}
} else {
items.push(path.to_str().unwrap().to_string());
} }
} else {
items.push(path.to_str().unwrap().to_string());
} }
} }
} }