@@ -79,13 +79,11 @@ pub fn read(build_state: &mut BuildState) -> CompileAssetsState {
79
79
"iast" | "ast" => {
80
80
let module_name = helpers:: file_path_to_module_name ( path, package_namespace) ;
81
81
82
- let res_file_path = get_res_path_from_ast ( & path) ;
83
82
let root_package = build_state
84
83
. packages
85
84
. get ( & build_state. root_config_name )
86
85
. expect ( "Could not find root package" ) ;
87
- if let Some ( res_file_path) = res_file_path {
88
- let res_file_path_buf = PathBuf :: from ( res_file_path) ;
86
+ if let Some ( res_file_path_buf) = get_res_path_from_ast ( & path) {
89
87
let _ = ast_modules. insert (
90
88
res_file_path_buf. clone ( ) ,
91
89
AstModule {
@@ -137,15 +135,15 @@ pub fn read(build_state: &mut BuildState) -> CompileAssetsState {
137
135
}
138
136
}
139
137
140
- fn get_res_path_from_ast ( ast_file : & Path ) -> Option < String > {
138
+ fn get_res_path_from_ast ( ast_file : & Path ) -> Option < PathBuf > {
141
139
if let Ok ( lines) = helpers:: read_lines ( ast_file) {
142
140
// we skip the first line with is some null characters
143
141
// the following lines in the AST are the dependency modules
144
- // we stop when we hit a line that starts with a "/" , this is the path of the file.
142
+ // we stop when we hit a line that is an absolute path , this is the path of the file.
145
143
// this is the point where the dependencies end and the actual AST starts
146
144
for line in lines. skip ( 1 ) {
147
145
match line {
148
- Ok ( line) if line . trim_start ( ) . starts_with ( '/' ) => return Some ( line) ,
146
+ Ok ( line) if Path :: new ( & line ) . is_absolute ( ) => return Some ( PathBuf :: from ( line) ) ,
149
147
_ => ( ) ,
150
148
}
151
149
}
0 commit comments