@@ -179,7 +179,7 @@ def search_filename(fname: str, lineno: int, local_first: bool) -> str:
179179 return fname
180180 else :
181181 for dir_ in i_path :
182- path = utils .sanitize_filename (os .path .join (dir_ , fname ))
182+ path = utils .get_absolute_filename_path ( utils . sanitize_filename (os .path .join (dir_ , fname ) ))
183183 if os .path .exists (path ):
184184 return path
185185
@@ -198,8 +198,9 @@ def include_file(filename: str, lineno: int, local_first: bool) -> str:
198198 """
199199 global CURRENT_DIR
200200
201- filename = search_filename (filename , lineno , local_first )
202- abs_filename = utils .get_absolute_filename_path (filename )
201+ abs_filename = search_filename (filename , lineno , local_first )
202+ filename = utils .get_relative_filename_path (abs_filename )
203+
203204 if abs_filename not in INCLUDED :
204205 INCLUDED [abs_filename ] = IncludedFileInfo (once = False , parents = [])
205206 elif INCLUDED [abs_filename ].once :
@@ -221,14 +222,14 @@ def include_once(filename: str, lineno: int, local_first: bool) -> str:
221222 at line <lineno>.
222223
223224 The file is ignored if it was previously included (a warning will
224- be emitted though).
225+ be emitted, though).
225226
226227 If local_first is True, then it will first search the file in the
227228 local path before looking for it in the include path chain.
228229 This is used when doing a #include "filename".
229230 """
230- filename = search_filename (filename , lineno , local_first )
231- abs_filename = utils . get_absolute_filename_path ( filename )
231+ abs_filename = search_filename (filename , lineno , local_first )
232+
232233 if abs_filename not in INCLUDED : # If not already included
233234 return include_file (filename , lineno , local_first ) # include it and return
234235
0 commit comments