@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
6161 MessageBox (NULL , " " , " " , MB_OK);
6262 #endif
6363
64- // look for help
64+ // help
6565 std::string dummy;
6666 if (bin2cpp::parseArgument (" help" , dummy, argc, argv))
6767 {
@@ -70,14 +70,14 @@ int main(int argc, char* argv[])
7070 return bin2cpp::ErrorCodes::Success;
7171 }
7272
73- // look for noheader
73+ // noheader
7474 bool noheader = false ;
7575 if (bin2cpp::parseArgument (" noheader" , dummy, argc, argv))
7676 {
7777 noheader = true ;
7878 }
7979
80- // look for quiet
80+ // quiet
8181 bool quiet = false ;
8282 if (bin2cpp::parseArgument (" quiet" , dummy, argc, argv))
8383 {
@@ -90,7 +90,7 @@ int main(int argc, char* argv[])
9090
9191 bin2cpp::setQuietMode (quiet);
9292
93- // look for version
93+ // version
9494 if (bin2cpp::parseArgument (" version" , dummy, argc, argv))
9595 {
9696 if (!noheader)
@@ -102,12 +102,12 @@ int main(int argc, char* argv[])
102102 printHeader ();
103103
104104 // mandatory arguments
105- std::string inputFilename ;
105+ std::string inputFile ;
106106 std::string outputFolder;
107107 std::string headerFilename;
108108 std::string functionIdentifier;
109109
110- if (!bin2cpp::parseArgument (" file" , inputFilename , argc, argv))
110+ if (!bin2cpp::parseArgument (" file" , inputFile , argc, argv))
111111 {
112112 bin2cpp::ErrorCodes error = bin2cpp::ErrorCodes::MissingArguments;
113113 bin2cpp::log (bin2cpp::LOG_ERROR, " %s (file)" , getErrorCodeDescription (error));
@@ -206,11 +206,11 @@ int main(int argc, char* argv[])
206206 std::string overrideInfo = " " ;
207207 if (overrideExisting)
208208 overrideInfo = " overriding existing files" ;
209- bin2cpp::log (bin2cpp::LOG_INFO, " Embedding \" %s\" into \" %s\" %s%s..." , inputFilename .c_str (), headerFilename.c_str (), chunkInfo.c_str (), overrideInfo.c_str ());
209+ bin2cpp::log (bin2cpp::LOG_INFO, " Embedding \" %s\" into \" %s\" %s%s..." , inputFile .c_str (), headerFilename.c_str (), chunkInfo.c_str (), overrideInfo.c_str ());
210210
211211 // generate header
212212 std::string outputHeaderPath = outputFolder + " \\ " + headerFilename;
213- bin2cpp::log (bin2cpp::LOG_INFO, " Writing header file \" %s\" ..." , outputHeaderPath.c_str ());
213+ bin2cpp::log (bin2cpp::LOG_INFO, " Writing file \" %s\" ..." , outputHeaderPath.c_str ());
214214 bin2cpp::ErrorCodes headerResult = bin2cpp::ErrorCodes::Success;
215215
216216 // check if header file already exists
@@ -222,30 +222,6 @@ int main(int argc, char* argv[])
222222 bin2cpp::log (bin2cpp::LOG_ERROR, " %s (%s)" , getErrorCodeDescription (error), outputHeaderPath.c_str ());
223223 return error;
224224 }
225-
226- // generate a temporary file and compare the two to see if they are different.
227- std::string tmpFileName = bin2cpp::getTemporaryFileName ();
228- std::string tempFilePath = bin2cpp::getEnvironmentVariable (" TEMP" ) + " \\ " + tmpFileName;
229- headerResult = generator->createHeaderEmbededFile (tempFilePath.c_str (), functionIdentifier.c_str ());
230-
231- // if still success
232- if (headerResult == bin2cpp::ErrorCodes::Success)
233- {
234- // If different, then override the existing one
235- // If the same, leave the existing file alone.
236- std::string existingFileMd5 = bin2cpp::getFileHexDigest (outputHeaderPath.c_str ());
237- std::string tempFileMd5 = bin2cpp::getFileHexDigest (tempFilePath.c_str ());
238-
239- // temporary file not required anymore
240- remove (tempFilePath.c_str ());
241-
242- // should we override the target file?
243- if (existingFileMd5 == tempFileMd5)
244- {
245- // existing file is up to date
246- headerResult = bin2cpp::ErrorCodes::OutputFilesSkipped;
247- }
248- }
249225 }
250226
251227 if (headerResult == bin2cpp::ErrorCodes::Success)
@@ -271,7 +247,7 @@ int main(int argc, char* argv[])
271247 // generate cpp
272248 std::string outputCppPath = outputFolder + " \\ " + headerFilename;
273249 bin2cpp::strReplace (outputCppPath, " .h" , " .cpp" );
274- bin2cpp::log (bin2cpp::LOG_INFO, " Writing cpp file \" %s\" ..." , outputCppPath.c_str ());
250+ bin2cpp::log (bin2cpp::LOG_INFO, " Writing file \" %s\" ..." , outputCppPath.c_str ());
275251 bin2cpp::ErrorCodes cppResult = bin2cpp::ErrorCodes::Success;
276252
277253 // check if cpp file already exists
@@ -285,36 +261,12 @@ int main(int argc, char* argv[])
285261 bin2cpp::log (bin2cpp::LOG_ERROR, " %s (%s)" , getErrorCodeDescription (error), outputCppPath.c_str ());
286262 return error;
287263 }
288-
289- // generate a temporary file and compare the two to see if they are different.
290- std::string tmpFileName = bin2cpp::getTemporaryFileName ();
291- std::string tempFilePath = bin2cpp::getEnvironmentVariable (" TEMP" ) + " \\ " + cppFilename;
292- cppResult = generator->createCppEmbeddedFile (inputFilename.c_str (), tempFilePath.c_str (), functionIdentifier.c_str (), chunkSize);
293-
294- // if still success
295- if (cppResult == bin2cpp::ErrorCodes::Success)
296- {
297- // If different, then override the existing one
298- // If the same, leave the existing file alone.
299- std::string existingFileMd5 = bin2cpp::getFileHexDigest (outputCppPath.c_str ());
300- std::string tempFileMd5 = bin2cpp::getFileHexDigest (tempFilePath.c_str ());
301-
302- // temporary file not required anymore
303- remove (tempFilePath.c_str ());
304-
305- // should we override the target file?
306- if (existingFileMd5 == tempFileMd5)
307- {
308- // existing file is up to date
309- cppResult = bin2cpp::ErrorCodes::OutputFilesSkipped;
310- }
311- }
312264 }
313265
314266 if (cppResult == bin2cpp::ErrorCodes::Success)
315267 {
316268 // generate file or override existing
317- cppResult = generator->createCppEmbeddedFile (inputFilename .c_str (), outputCppPath.c_str (), functionIdentifier.c_str (), chunkSize);
269+ cppResult = generator->createCppEmbeddedFile (inputFile .c_str (), outputCppPath.c_str (), functionIdentifier.c_str (), chunkSize);
318270 }
319271 if (cppResult == bin2cpp::ErrorCodes::Success)
320272 {
0 commit comments