Previous replace was done on the complete path. A path containing
.c or .o would result in a corrupted file path.
Reported-by: Gunnar Strand <Gunnar.Strand@ericsson.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
def write(self):
outputFile = open(self.outputFilename,"w")
def write(self):
outputFile = open(self.outputFilename,"w")
- headerFilename = self.outputFilename.replace(".c",".h")
+ headerFilename = self.outputFilename
+ if headerFilename.endswith(".c"):
+ headerFilename = headerFilename[:-2] + ".h"
outputFile.write(CFile.FILE_TPL.format(
headerFilename = headerFilename))
outputFile.write(CFile.FILE_TPL.format(
headerFilename = headerFilename))
return cc
def write(self):
return cc
def write(self):
- cFilename = self.outputFilename.replace(".o",".c")
+ cFilename = self.outputFilename
+ if cFilename.endswith(".o"):
+ cFilename = cFilename[:-2] + ".c"
+
cc = self._detectCC()
if cc == "":
raise RuntimeError("No C Compiler detected")
cc = self._detectCC()
if cc == "":
raise RuntimeError("No C Compiler detected")