configurationengine/source/plugins/symbian/ConeHCRPlugin/hcrplugin/header_writer.py
equal
deleted
inserted
replaced
15 # |
15 # |
16 |
16 |
17 import os |
17 import os |
18 |
18 |
19 class HeaderWriter(object): |
19 class HeaderWriter(object): |
20 def __init__(self,output_file, output_obj): |
20 def __init__(self, output_file, output_obj): |
21 self.output_obj = output_obj |
21 self.output_obj = output_obj |
22 self.output_file = output_file |
22 self.output_file = output_file |
23 |
23 |
24 def write(self): |
24 def write(self, context): |
25 header_guard = os.path.basename(self.output_file).upper() |
25 header_guard = os.path.basename(self.output_file).upper() |
26 header_guard = header_guard.replace('/', '_').replace('\\', '_').replace('.', '_') |
26 header_guard = header_guard.replace('/', '_').replace('\\', '_').replace('.', '_') |
27 lines = [ |
27 lines = [ |
28 "#ifndef %s" % header_guard, |
28 "#ifndef %s" % header_guard, |
29 "#define %s" % header_guard, |
29 "#define %s" % header_guard, |
54 lines.extend([ |
54 lines.extend([ |
55 "", |
55 "", |
56 "#endif", |
56 "#endif", |
57 ]) |
57 ]) |
58 |
58 |
59 f = open(self.output_file, 'wb') |
59 f = context.create_file(self.output_file, mode='wb') |
60 try: f.write(os.linesep.join(lines)) |
60 try: f.write('\r\n'.join(lines)) |
61 finally: f.close() |
61 finally: f.close() |