Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame^] | 1 | use std::fs::File; |
2 | use std::io::prelude::*; | ||||
3 | |||||
4 | use runfiles::Runfiles; | ||||
5 | |||||
6 | fn main() { | ||||
7 | let r = Runfiles::create().unwrap(); | ||||
8 | |||||
9 | let mut f = File::open(r.rlocation("examples/hello_runfiles/hello_runfiles.rs")).unwrap(); | ||||
10 | |||||
11 | let mut buffer = String::new(); | ||||
12 | f.read_to_string(&mut buffer).unwrap(); | ||||
13 | |||||
14 | println!("This program's source is {} characters long.", buffer.len()); | ||||
15 | } |