[libcalamaresui] Paste the last 16KiB of the log file

- If Calamares is run more than once, reading the log file
  can get you older / not relevant log messages. Get the tail
  end instead.
main
Adriaan de Groot 4 years ago
parent 980e5e13f8
commit 9f17d3fd12

@ -12,11 +12,15 @@
#include "Branding.h"
#include "DllMacro.h"
#include "utils/Logger.h"
#include "utils/Units.h"
#include <QFile>
#include <QFileInfo>
#include <QTcpSocket>
#include <QUrl>
using namespace CalamaresUtils::Units;
/** @brief Reads the logfile, returns its contents.
*
* Returns an empty QByteArray() on any kind of error.
@ -30,8 +34,12 @@ logFileContents()
cError() << "Could not open log file";
return QByteArray();
}
// TODO: read the **last** 16kiB?
return pasteSourceFile.read( 16384 /* bytes */ );
QFileInfo fi( pasteSourceFile );
if ( fi.size() > 16_KiB )
{
pasteSourceFile.seek( fi.size() - 16_KiB );
}
return pasteSourceFile.read( 16_KiB );
}

Loading…
Cancel
Save