File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ namespace bin2cpp
196196 virtual bool save(const char * filename) const = 0;
197197 };
198198 #endif // BIN2CPP_EMBEDDEDFILE_CLASS
199- const File & getHelloworldhtmlFile ();
199+ const File & getHelloworldHtmlFile ();
200200}; // bin2cpp
201201
202202#endif // HELLOWORLD_H
@@ -222,11 +222,11 @@ namespace bin2cpp
222222#include < fstream> // for ofstream
223223namespace bin2cpp
224224{
225- class HelloworldhtmlFile : public virtual bin2cpp::File
225+ class HelloworldHtmlFile : public virtual bin2cpp::File
226226 {
227227 public:
228- HelloworldhtmlFile () { build(); }
229- virtual ~ HelloworldhtmlFile () {}
228+ HelloworldHtmlFile () { build(); }
229+ virtual ~ HelloworldHtmlFile () {}
230230 virtual size_t getSize() const { return 238; }
231231 virtual const char * getFileName() const { return "helloworld.html"; }
232232 virtual const char * getFilePath() const { return getFileName(); }
@@ -251,7 +251,7 @@ namespace bin2cpp
251251 private:
252252 std::string mBuffer;
253253 };
254- const File & getHelloworldhtmlFile () { static HelloworldhtmlFile _ instance; return _ instance; }
254+ const File & getHelloworldHtmlFile () { static HelloworldHtmlFile _ instance; return _ instance; }
255255}; // bin2cpp
256256```
257257
Original file line number Diff line number Diff line change 77int main (int argc, char * argv[])
88{
99 // get a reference to the embedded file
10- const bin2cpp::File & resource = bin2cpp::getHelloworldhtmlFile ();
10+ const bin2cpp::File & resource = bin2cpp::getHelloworldHtmlFile ();
1111
1212 // print information about the file.
1313 std::cout << " Embedded file '" << resource.getFileName () << " ' is " << resource.getSize () << " bytes long.\n " ;
Original file line number Diff line number Diff line change @@ -157,8 +157,12 @@ namespace bin2cpp
157157 {
158158 std::string id;
159159
160- // get filename of the given path
161- id = ra::filesystem::GetFilename (path.c_str ());
160+ // build default id
161+ std::string name = ra::filesystem::GetFilenameWithoutExtension (path.c_str ());
162+ std::string ext = ra::filesystem::GetFileExtention (path.c_str ());
163+ name = ra::strings::CapitalizeFirstCharacter (name);
164+ ext = ra::strings::CapitalizeFirstCharacter (ext );
165+ id = name + ext;
162166
163167 // filter out characters which are not alphanumeric characters or '_'.
164168 static const std::string validCharacters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" ;
Original file line number Diff line number Diff line change @@ -562,7 +562,7 @@ TEST_F(TestExtraction, testIssue56a)
562562 std::string output_path1234 = " generated_files/testIssue56a/saved_files/_testIssue56a.index.1234.css" ;
563563 {
564564 ra::filesystem::NormalizePath (output_path1234);
565- const issue56a::File & file = issue56a::get_testIssue56aindex1234cssFile ();
565+ const issue56a::File & file = issue56a::get_testIssue56aindex1234CssFile ();
566566 bool extractSuccess = file.save (output_path1234.c_str ());
567567 ASSERT_TRUE (extractSuccess);
568568 }
@@ -571,7 +571,7 @@ TEST_F(TestExtraction, testIssue56a)
571571 std::string output_path4321 = " generated_files/testIssue56a/saved_files/_testIssue56a.index.4321.css" ;
572572 {
573573 ra::filesystem::NormalizePath (output_path4321);
574- const issue56a::File & file = issue56a::get_testIssue56aindex4321cssFile ();
574+ const issue56a::File & file = issue56a::get_testIssue56aindex4321CssFile ();
575575 bool extractSuccess = file.save (output_path4321.c_str ());
576576 ASSERT_TRUE (extractSuccess);
577577 }
You can’t perform that action at this time.
0 commit comments