@@ -154,6 +154,7 @@ pub struct YamlFrameReader {
154
154
include_only : Vec < String > ,
155
155
156
156
watch_source : bool ,
157
+ list_resources : bool ,
157
158
158
159
/// A HashMap of offsets which specify what scroll offsets particular
159
160
/// scroll layers should be initialized with.
@@ -170,6 +171,7 @@ impl YamlFrameReader {
170
171
pub fn new ( yaml_path : & Path ) -> YamlFrameReader {
171
172
YamlFrameReader {
172
173
watch_source : false ,
174
+ list_resources : false ,
173
175
frame_built : false ,
174
176
yaml_path : yaml_path. to_owned ( ) ,
175
177
aux_dir : yaml_path. parent ( ) . unwrap ( ) . to_owned ( ) ,
@@ -207,6 +209,7 @@ impl YamlFrameReader {
207
209
let yaml_file = args. value_of ( "INPUT" ) . map ( |s| PathBuf :: from ( s) ) . unwrap ( ) ;
208
210
209
211
let mut y = YamlFrameReader :: new ( & yaml_file) ;
212
+ y. list_resources = args. is_present ( "list-resources" ) ;
210
213
y. watch_source = args. is_present ( "watch" ) ;
211
214
y. queue_depth = args. value_of ( "queue" )
212
215
. map ( |s| s. parse :: < u32 > ( ) . unwrap ( ) )
@@ -308,6 +311,7 @@ impl YamlFrameReader {
308
311
return * k;
309
312
}
310
313
314
+ if self . list_resources { println ! ( "{}" , file. to_string_lossy( ) ) ; }
311
315
let ( descriptor, image_data) = match image:: open ( file) {
312
316
Ok ( image) => {
313
317
let image_dims = image. dimensions ( ) ;
@@ -373,13 +377,15 @@ impl YamlFrameReader {
373
377
}
374
378
375
379
fn get_or_create_font ( & mut self , desc : FontDescriptor , wrench : & mut Wrench ) -> FontKey {
380
+ let list_resources = self . list_resources ;
376
381
* self . fonts
377
382
. entry ( desc. clone ( ) )
378
383
. or_insert_with ( || match desc {
379
384
FontDescriptor :: Path {
380
385
ref path,
381
386
font_index,
382
387
} => {
388
+ if list_resources { println ! ( "{}" , path. to_string_lossy( ) ) ; }
383
389
let mut file = File :: open ( path) . expect ( "Couldn't open font file" ) ;
384
390
let mut bytes = vec ! [ ] ;
385
391
file. read_to_end ( & mut bytes)
0 commit comments