Browse Source

print out files patchserver knows about

pbs
Jake Probst 6 years ago
parent
commit
b72117e152
  1. 19
      src/patch/main.rs

19
src/patch/main.rs

@ -389,7 +389,26 @@ fn main() {
let listener = TcpListener::bind(&SocketAddr::from((Ipv4Addr::new(0,0,0,0), PATCH_PORT))).unwrap(); let listener = TcpListener::bind(&SocketAddr::from((Ipv4Addr::new(0,0,0,0), PATCH_PORT))).unwrap();
let (patch_file_tree, patch_file_lookup) = generate_patch_tree("patchfiles/"); let (patch_file_tree, patch_file_lookup) = generate_patch_tree("patchfiles/");
println!("[patch] files to patch:");
let mut indent = 0;
for item in patch_file_tree.flatten() {
match item {
PatchTreeIterItem::Directory(path) => {
let s = path.to_str().unwrap();
println!("{: >2$}\u{2517}\u{2500}\u{2500} {}", "", s, indent * 4);
indent += 1;
},
PatchTreeIterItem::File(path, id) => {
let s = path.to_str().unwrap();
println!("{: >3$}\u{2520}\u{2500}\u{2500} {} ({})", "", s, id, indent * 4);
},
PatchTreeIterItem::UpDirectory => {
indent -= 1;
}
}
}
println!("[patch] waiting for connections");
while let Ok((socket, addr)) = listener.accept() { while let Ok((socket, addr)) = listener.accept() {
let local_patch_file_tree = patch_file_tree.clone(); let local_patch_file_tree = patch_file_tree.clone();
let local_patch_file_lookup = patch_file_lookup.clone(); let local_patch_file_lookup = patch_file_lookup.clone();

Loading…
Cancel
Save