Open/empty update_log.csv/.csv.copy at start. Added some debug-output
This commit is contained in:
parent
3034f49c96
commit
61c847102d
52
update.cpp
52
update.cpp
@ -92,31 +92,55 @@ Update::Update(hwinf *hw,
|
|||||||
, m_maintenanceMode(maintenanceMode)
|
, m_maintenanceMode(maintenanceMode)
|
||||||
, m_init(true) {
|
, m_init(true) {
|
||||||
|
|
||||||
execUpdateScript();
|
// make sure the files are empty
|
||||||
|
if (m_update_ctrl_file.exists()) {
|
||||||
if (!m_update_ctrl_file.exists()) {
|
if (m_update_ctrl_file.open(QIODevice::ReadWrite |
|
||||||
|
QIODevice::Truncate |
|
||||||
|
QIODevice::Text)) {
|
||||||
|
m_update_ctrl_file.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
qCritical() << "Update-file" << m_update_ctrl_file.fileName()
|
qCritical() << "Update-file" << m_update_ctrl_file.fileName()
|
||||||
<< "does not exist";
|
<< "does not exist";
|
||||||
m_init = false;
|
m_init = false;
|
||||||
}
|
}
|
||||||
if (!m_update_ctrl_file_copy.exists()) {
|
if (m_update_ctrl_file_copy.exists()) {
|
||||||
|
if (m_update_ctrl_file_copy.open(QIODevice::ReadWrite |
|
||||||
|
QIODevice::Truncate |
|
||||||
|
QIODevice::Text)) {
|
||||||
|
m_update_ctrl_file_copy.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
qCritical() << "Update-file-copy" << m_update_ctrl_file_copy.fileName()
|
qCritical() << "Update-file-copy" << m_update_ctrl_file_copy.fileName()
|
||||||
<< "does not exist";
|
<< "does not exist";
|
||||||
m_init = false;
|
m_init = false;
|
||||||
}
|
}
|
||||||
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
|
||||||
qCritical() << "can not open " << m_update_ctrl_file.fileName();
|
// execute update_psa-script
|
||||||
m_init = false;
|
if (m_init) {
|
||||||
|
if ((m_init = execUpdateScript()) == false) {
|
||||||
|
qCritical() << "UPDATE_SCRIPT FAILED";
|
||||||
|
} else {
|
||||||
|
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||||
|
qCritical() << "CAN NOT OPEN" << m_update_ctrl_file.fileName();
|
||||||
|
m_init = false;
|
||||||
|
} else {
|
||||||
|
qDebug() << "OPENED" << m_update_ctrl_file.fileName();
|
||||||
|
}
|
||||||
|
if (!m_update_ctrl_file_copy.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||||
|
qCritical() << "CAN NOT OPEN" << m_update_ctrl_file_copy.fileName();
|
||||||
|
m_init = false;
|
||||||
|
} else {
|
||||||
|
qDebug() << "OPENED" << m_update_ctrl_file_copy.fileName();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "Opened" << m_update_ctrl_file.fileName();
|
|
||||||
if (!m_update_ctrl_file_copy.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
|
||||||
qCritical() << "can not open " << m_update_ctrl_file_copy.fileName();
|
|
||||||
m_init = false;
|
|
||||||
}
|
|
||||||
qDebug() << "Opened" << m_update_ctrl_file_copy.fileName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Update::~Update() {
|
Update::~Update() {
|
||||||
|
// make sure the files are closed
|
||||||
|
m_update_ctrl_file.close();
|
||||||
|
m_update_ctrl_file_copy.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::execUpdateScript() {
|
bool Update::execUpdateScript() {
|
||||||
@ -602,6 +626,7 @@ bool Update::doUpdate() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!m_init) {
|
if (!m_init) {
|
||||||
|
qCritical() << "DO UPDATE: INITIALIZATION OR UPDATE-SCRIPT FAILED";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,6 +637,7 @@ bool Update::doUpdate() {
|
|||||||
qCritical() << "No lines to handle in" << m_update_ctrl_file.fileName();
|
qCritical() << "No lines to handle in" << m_update_ctrl_file.fileName();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "open lines...";
|
qDebug() << "open lines...";
|
||||||
for (int i=0; i< linesToWorkOn.size(); ++i) {
|
for (int i=0; i< linesToWorkOn.size(); ++i) {
|
||||||
qDebug() << "line" << i << ":" << linesToWorkOn.at(i).trimmed();
|
qDebug() << "line" << i << ":" << linesToWorkOn.at(i).trimmed();
|
||||||
|
Loading…
Reference in New Issue
Block a user