ENH: rename tracked crash log
Change-Id: I60d1c1af873c60776334f26503e22230bb541e0a
This commit is contained in:
parent
fddd101685
commit
02fbd88150
|
@ -1141,22 +1141,26 @@ void GUI_App::post_init()
|
||||||
{
|
{
|
||||||
std::string file_name = iter->path().stem().string();
|
std::string file_name = iter->path().stem().string();
|
||||||
if (boost::starts_with(file_name, "crash")) {
|
if (boost::starts_with(file_name, "crash")) {
|
||||||
std::ifstream ifs(iter->path().string(), ios::in);
|
if (file_name.find("done") == std::string::npos) {
|
||||||
std::stringstream data;
|
std::ifstream ifs(iter->path().string(), ios::in);
|
||||||
data << ifs.rdbuf();
|
std::stringstream data;
|
||||||
ifs.close();
|
data << ifs.rdbuf();
|
||||||
|
ifs.close();
|
||||||
|
|
||||||
NetworkAgent* agent = wxGetApp().getAgent();
|
NetworkAgent* agent = wxGetApp().getAgent();
|
||||||
json j;
|
json j;
|
||||||
j["time"] = file_name.substr(file_name.find("crash") + strlen("crash") + 1);
|
j["time"] = file_name.substr(file_name.find("crash") + strlen("crash") + 1);
|
||||||
j["verion"] = std::string(SLIC3R_VERSION);
|
j["verion"] = std::string(SLIC3R_VERSION);
|
||||||
j["content"] = decode_path(data.str().c_str());
|
j["content"] = decode_path(data.str().c_str());
|
||||||
try {
|
try {
|
||||||
if (agent) {
|
if (agent) {
|
||||||
agent->track_event("studio_crash", j.dump()); }
|
agent->track_event("studio_crash", j.dump());
|
||||||
} catch (...) {}
|
}
|
||||||
std::string new_file_name = file_name.insert(0, "_done_");
|
}
|
||||||
boost::filesystem::rename(iter->path(), iter->path().parent_path() / boost::filesystem::path(new_file_name + iter->path().extension().string()));
|
catch (...) {}
|
||||||
|
std::string new_file_name = file_name.append("_done");
|
||||||
|
boost::filesystem::rename(iter->path(), iter->path().parent_path() / boost::filesystem::path(new_file_name + iter->path().extension().string()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue