diff options
Diffstat (limited to 'giscanner/codegen.py')
-rw-r--r-- | giscanner/codegen.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/giscanner/codegen.py b/giscanner/codegen.py index ce07aaa1..138acf72 100644 --- a/giscanner/codegen.py +++ b/giscanner/codegen.py @@ -18,6 +18,7 @@ # Boston, MA 02111-1307, USA. # +import os from contextlib import contextmanager from . import ast @@ -142,7 +143,9 @@ class CCodeGenerator(object): for header in self.include_first_src: self.out_c.write("""#include "%s"\n""" % header) - self.out_c.write("""#include "%s"\n\n""" % (self.out_h_filename, )) + src_dir = os.path.dirname(os.path.realpath(self.out_c.name)) + header = os.path.relpath(self.out_h_filename, src_dir) + self.out_c.write("""#include "%s"\n\n""" % (header, )) for header in self.include_last_src: self.out_c.write("""#include "%s"\n""" % header) |