File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ edition = "2024"
77cxx = " 1.0.194"
88thiserror = " 2.0.12"
99
10+ [target .'cfg(windows)' .dependencies ]
11+ dunce = " 1.0.4"
12+
1013[build-dependencies ]
1114cmake = " 0.1.57"
1215cxx-build = " 1.0.194"
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ impl SlangSession {
150150 defines : & [ String ] ,
151151 ) -> Result < Vec < usize > > {
152152 let files_vec = files. to_vec ( ) ;
153- let includes_vec = includes . to_vec ( ) ;
153+ let includes_vec = normalize_include_dirs ( includes ) ? ;
154154 let defines_vec = defines. to_vec ( ) ;
155155
156156 let start = self . tree_count ( ) ;
@@ -220,3 +220,23 @@ impl Default for SlangSession {
220220 Self :: new ( )
221221 }
222222}
223+
224+ #[ cfg( windows) ]
225+ fn normalize_include_dirs ( includes : & [ String ] ) -> Result < Vec < String > > {
226+ let mut out = Vec :: with_capacity ( includes. len ( ) ) ;
227+ for include in includes {
228+ let canonical = dunce:: canonicalize ( include) . map_err ( |cause| SlangError :: ParseGroup {
229+ message : format ! (
230+ "Failed to canonicalize include directory '{}': {}" ,
231+ include, cause
232+ ) ,
233+ } ) ?;
234+ out. push ( canonical. to_string_lossy ( ) . into_owned ( ) ) ;
235+ }
236+ Ok ( out)
237+ }
238+
239+ #[ cfg( not( windows) ) ]
240+ fn normalize_include_dirs ( includes : & [ String ] ) -> Result < Vec < String > > {
241+ Ok ( includes. to_vec ( ) )
242+ }
You can’t perform that action at this time.
0 commit comments