@@ -286,7 +286,7 @@ impl<'a> Section<'a> {
286
286
}
287
287
SectionData :: InstancesSummary => {
288
288
let instances = self . ladfile . globals . iter ( ) . collect :: < Vec < _ > > ( ) ;
289
- let types_directory = self . parent_path . join ( "types" ) . to_string_lossy ( ) . to_string ( ) ;
289
+ let types_directory = PathBuf :: from ( "/" ) . join ( self . parent_path . join ( "types" ) ) ;
290
290
vec ! [ SectionItem :: InstancesSummary {
291
291
instances,
292
292
ladfile: self . ladfile,
@@ -355,11 +355,7 @@ impl<'a> Section<'a> {
355
355
]
356
356
}
357
357
SectionData :: FunctionDetail { function } => {
358
- let types_directory = self
359
- . parent_path
360
- . join ( "../types" )
361
- . to_string_lossy ( )
362
- . to_string ( ) ;
358
+ let types_directory = self . parent_path . join ( "../types" ) ;
363
359
vec ! [ SectionItem :: FunctionDetails {
364
360
function,
365
361
ladfile: self . ladfile,
@@ -404,7 +400,7 @@ pub enum SectionItem<'a> {
404
400
FunctionDetails {
405
401
function : & ' a LadFunction ,
406
402
ladfile : & ' a ladfile:: LadFile ,
407
- types_directory : String ,
403
+ types_directory : PathBuf ,
408
404
} ,
409
405
TypesSummary {
410
406
types : Vec < & ' a LadTypeId > ,
@@ -414,7 +410,7 @@ pub enum SectionItem<'a> {
414
410
InstancesSummary {
415
411
ladfile : & ' a ladfile:: LadFile ,
416
412
instances : Vec < ( & ' a Cow < ' static , str > , & ' a LadInstance ) > ,
417
- types_directory : String ,
413
+ types_directory : PathBuf ,
418
414
} ,
419
415
}
420
416
@@ -576,7 +572,7 @@ impl IntoMarkdown for SectionItem<'_> {
576
572
move |lad_type_id, ladfile| {
577
573
let printed_type =
578
574
linkify_filename ( print_type ( ladfile, & lad_type_id) ) ;
579
- Some ( format ! ( "/{ types_directory}/{ printed_type}. md") )
575
+ Some ( types_directory. join ( printed_type) . with_extension ( " md") )
580
576
} ,
581
577
) ;
582
578
arg_visitor. visit ( & v. type_kind ) ;
@@ -650,7 +646,7 @@ impl IntoMarkdown for SectionItem<'_> {
650
646
idx,
651
647
arg,
652
648
ladfile,
653
- types_directory,
649
+ types_directory. clone ( ) ,
654
650
builder,
655
651
) ;
656
652
}
@@ -663,7 +659,7 @@ impl IntoMarkdown for SectionItem<'_> {
663
659
0 ,
664
660
& function. return_type ,
665
661
ladfile,
666
- types_directory,
662
+ types_directory. clone ( ) ,
667
663
builder,
668
664
)
669
665
} ) ;
@@ -676,7 +672,7 @@ fn build_lad_function_argument_row(
676
672
idx : usize ,
677
673
arg : & LadArgument ,
678
674
ladfile : & LadFile ,
679
- types_directory : & str ,
675
+ types_directory : PathBuf ,
680
676
builder : & mut TableBuilder ,
681
677
) {
682
678
// we exclude function call context as it's not something scripts pass down
@@ -691,7 +687,7 @@ fn build_lad_function_argument_row(
691
687
let mut arg_visitor =
692
688
MarkdownArgumentVisitor :: new_with_linkifier ( ladfile, move |lad_type_id, ladfile| {
693
689
let printed_type = linkify_filename ( print_type ( ladfile, & lad_type_id) ) ;
694
- Some ( format ! ( "{}/{}. md", types_directory , printed_type ) )
690
+ Some ( types_directory . join ( printed_type ) . with_extension ( " md") )
695
691
} ) ;
696
692
arg_visitor. visit ( & arg. kind ) ;
697
693
let markdown = build_escaped_visitor ( arg_visitor) ;
0 commit comments