slint/tools/viewer/main.rs
Simon Hausmann 2f0718bffa Add include path options to the viewer and compiler
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
2020-07-17 15:26:35 +02:00

27 lines
813 B
Rust

use structopt::StructOpt;
#[derive(StructOpt)]
struct Cli {
#[structopt(short = "I", name = "include path for other .60 files", number_of_values = 1)]
include_paths: Vec<std::path::PathBuf>,
#[structopt(name = "path to .60 file", parse(from_os_str))]
path: std::path::PathBuf,
}
fn main() -> std::io::Result<()> {
let args = Cli::from_args();
let source = std::fs::read_to_string(&args.path)?;
let c = match sixtyfps_interpreter::load(source, &args.path, &args.include_paths) {
Ok(c) => c,
Err(diag) => {
diag.print();
std::process::exit(-1);
}
};
let window = sixtyfps_rendering_backend_gl::create_gl_window();
let component = c.create();
window.run(component.borrow(), &component.window_properties());
Ok(())
}