fix logic bug
This commit is contained in:
@ -773,9 +773,12 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
// check if file is a LAMMPS restart
|
// check if file is a LAMMPS restart
|
||||||
char magic[16] = " ";
|
char magic[16] = " ";
|
||||||
QFile file(word);
|
QFile file(word);
|
||||||
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
QDataStream in(&file);
|
QDataStream in(&file);
|
||||||
in.readRawData(magic, 16);
|
in.readRawData(magic, 16);
|
||||||
if (strcmp(magic, LAMMPS_MAGIC) != 0) {
|
file.close();
|
||||||
|
}
|
||||||
|
if (strcmp(magic, LAMMPS_MAGIC) == 0) {
|
||||||
auto *action = menu->addAction(QString("Inspect restart file '%1'").arg(word));
|
auto *action = menu->addAction(QString("Inspect restart file '%1'").arg(word));
|
||||||
action->setIcon(QIcon(":/icons/document-open.png"));
|
action->setIcon(QIcon(":/icons/document-open.png"));
|
||||||
action->setData(word);
|
action->setData(word);
|
||||||
|
|||||||
Reference in New Issue
Block a user