Account for windows path in tree example
@@ -3,12 +3,22 @@ use std::env;
fn main() {
let path = env::current_dir().unwrap();
+ let path: String = path
+ .to_str()
+ .unwrap()
+ .chars()
+ .enumerate()
+ .map(|(_, c)| match c {
+ '\\' => '/',
+ _ => c,
+ })
+ .collect();
let app = App::default().set_scheme(AppScheme::Gtk);
let mut wind = Window::new(100, 100, 400, 300, "Hello from rust");
let mut but = Button::new(160, 255, 80, 40, "Get Items");
let mut tree = Tree::new(5, 10, 190, 240, "");
- tree.add(path.to_str().unwrap()); // Works for unix paths!
+ tree.add(&path);
let mut items = tree.get_items().unwrap();
items.as_mut_slice()[0].set_label("/");
