@@ -8,7 +8,7 @@ use indexmap::IndexMap;
88use rustc_hash:: FxHasher ;
99use serde:: Deserialize ;
1010
11- use crate :: path:: { path_to_str , PathUtil } ;
11+ use crate :: path:: { path_to_utf8 , PathUtil } ;
1212
1313pub type CompilerOptionsPathsMap = IndexMap < String , Vec < String > , BuildHasherDefault < FxHasher > > ;
1414
@@ -78,7 +78,7 @@ pub struct ProjectReference {
7878}
7979
8080impl TsConfig {
81- #[ cfg_attr( feature="enable_instrument" , tracing:: instrument( level=tracing:: Level :: DEBUG , skip_all, fields( path = path_to_str ( path) ) ) ) ]
81+ #[ cfg_attr( feature="enable_instrument" , tracing:: instrument( level=tracing:: Level :: DEBUG , skip_all, fields( path = path_to_utf8 ( path) . as_str ( ) ) ) ) ]
8282 pub fn parse ( root : bool , path : & Path , json : & mut str ) -> Result < Self , serde_json:: Error > {
8383 _ = json_strip_comments:: strip ( json) ;
8484 if json. trim ( ) . is_empty ( ) {
@@ -121,12 +121,14 @@ impl TsConfig {
121121 }
122122 }
123123
124- let mut p = path_to_str ( & self . compiler_options . paths_base ) . to_string ( ) ;
124+ let mut p = path_to_utf8 ( & self . compiler_options . paths_base )
125+ . as_str ( )
126+ . to_string ( ) ;
125127 Self :: substitute_template_variable ( & dir, & mut p) ;
126128 self . compiler_options . paths_base = p. into ( ) ;
127129
128130 if let Some ( base_url) = self . compiler_options . base_url . as_mut ( ) {
129- let mut p = path_to_str ( base_url) . to_string ( ) ;
131+ let mut p = path_to_utf8 ( base_url) . as_str ( ) . to_string ( ) ;
130132 Self :: substitute_template_variable ( & dir, & mut p) ;
131133 * base_url = p. into ( ) ;
132134 }
@@ -258,9 +260,13 @@ impl TsConfig {
258260 fn substitute_template_variable ( directory : & Path , path : & mut String ) {
259261 if let Some ( stripped_path) = path. strip_prefix ( TEMPLATE_VARIABLE ) {
260262 if let Some ( unleashed_path) = stripped_path. strip_prefix ( "/" ) {
261- * path = path_to_str ( & directory. join ( unleashed_path) ) . to_string ( ) ;
263+ * path = path_to_utf8 ( & directory. join ( unleashed_path) )
264+ . as_str ( )
265+ . to_string ( ) ;
262266 } else {
263- * path = path_to_str ( & directory. join ( stripped_path) ) . to_string ( ) ;
267+ * path = path_to_utf8 ( & directory. join ( stripped_path) )
268+ . as_str ( )
269+ . to_string ( ) ;
264270 }
265271 }
266272 }
0 commit comments