@@ -25,7 +25,7 @@ namespace bin2cpp
2525 return " segment" ;
2626 }
2727
28- bin2cpp::ErrorCodes SegmentGenerator::createCppEmbeddedFile (const char * iInputFilename, const char * iOutputFolder, const char * iHeaderFilename , const char * iFunctionIdentifier, size_t iChunkSize)
28+ bin2cpp::ErrorCodes SegmentGenerator::createCppEmbeddedFile (const char * iInputFilename, const char * iCppFilePath , const char * iFunctionIdentifier, size_t iChunkSize)
2929 {
3030 // check if input file exists
3131 FILE * input = fopen (iInputFilename, " rb" );
@@ -37,11 +37,13 @@ namespace bin2cpp
3737 functionIdentifier[0 ] = (char )toupper (functionIdentifier[0 ]);
3838
3939 // Build header and cpp file path
40- std::string headerPath = getHeaderFilePath (iOutputFolder, iHeaderFilename);
41- std::string outputCppFilename = getCppFilePath (iOutputFolder, iHeaderFilename);
40+ std::string headerPath = getHeaderFilePath (iCppFilePath);
41+ std::string cppPath = iCppFilePath;
42+ std::string headerFilename = getFilename (headerPath.c_str ());
43+ std::string cppFilename = getFilename (iCppFilePath);
4244
4345 // create cpp file
44- FILE * cpp = fopen (outputCppFilename .c_str (), " w" );
46+ FILE * cpp = fopen (cppPath .c_str (), " w" );
4547 if (!cpp)
4648 {
4749 fclose (input);
@@ -67,7 +69,7 @@ namespace bin2cpp
6769 fprintf (cpp, " * Copyright (C) 2013-%d end2endzone.com. All rights reserved.\n " , bin2cpp::getCopyrightYear ());
6870 fprintf (cpp, " * Do not modify this file.\n " );
6971 fprintf (cpp, " */\n " );
70- fprintf (cpp, " #include \" %s\"\n " , iHeaderFilename );
72+ fprintf (cpp, " #include \" %s\"\n " , headerFilename. c_str () );
7173 fprintf (cpp, " #include <stdio.h> //for FILE\n " );
7274 fprintf (cpp, " #include <string> //for memcpy\n " );
7375 fprintf (cpp, " namespace bin2cpp\n " );
@@ -96,7 +98,7 @@ namespace bin2cpp
9698 // read a chunk of the file
9799 size_t readSize = fread (buffer, 1 , iChunkSize, input);
98100
99- bool isLastChunk = !(readSize == iChunkSize);
101+ // bool isLastChunk = !(readSize == iChunkSize);
100102
101103 if (readSize == 0 )
102104 continue ; // nothing to output if nothing was read
0 commit comments