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