Skip to content

Commit

Permalink
Merge pull request SimonKagstrom#260 from lisongmin/index.json-can-no…
Browse files Browse the repository at this point in the history
…t-load

Code coverage report behind nginx/1.15.0 can not show well which respose index.json as application/json
  • Loading branch information
SimonKagstrom authored Jun 11, 2018
2 parents 964a97c + e7f4696 commit 54236ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<font color=red><B>ERROR:</B></font> JavaScript need to be enabled for the coverage report to work.
</noscript>

<script type="text/javascript" src="index.json"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="data/js/jquery.min.js"></script>
<script type="text/javascript" src="data/js/tablesorter.min.js"></script>
<script type="text/javascript" src="data/js/jquery.tablesorter.widgets.min.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/writers/html-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class HtmlWriter : public WriterBase
unsigned int nTotalCodeLines = 0;

// Out-file for JSON data
std::ofstream outJson(m_outDirectory + "index.json");
std::ofstream outJson(m_outDirectory + "index.js");
outJson << "var data = {files:[\n"; // Not really json, but anyway

for (FileMap_t::const_iterator it = m_files.begin();
Expand Down Expand Up @@ -233,7 +233,7 @@ class HtmlWriter : public WriterBase
dir = opendir(idx.c_str());
panic_if(!dir, "Can't open directory %s\n", idx.c_str());

std::ofstream outJson(m_indexDirectory + "index.json");
std::ofstream outJson(m_indexDirectory + "index.js");

outJson << "var data = {files:[\n";
std::string merged;
Expand Down
2 changes: 1 addition & 1 deletion src/writers/writer-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ WriterBase::File::File(const std::string &filename) :
readFile(filename);

m_outFileName = fmt("%s.%x.html", m_fileName.c_str(), m_crc);
m_jsonOutFileName = fmt("%s.%x.json", m_fileName.c_str(), m_crc);
m_jsonOutFileName = fmt("%s.%x.js", m_fileName.c_str(), m_crc);
}

void WriterBase::File::readFile(const std::string &filename)
Expand Down

0 comments on commit 54236ce

Please sign in to comment.