Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.

Commit c30d9fa

Browse files
author
ETCG
committed
Critical Bug Fix
1 parent 03561f4 commit c30d9fa

10 files changed

Lines changed: 72 additions & 40 deletions

File tree

4.13 KB
Binary file not shown.

BootableDriveMaker.app/Contents/MacOS/findDevs.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

BootableDriveMaker.dmg

1.55 KB
Binary file not shown.

source/BootableDriveMaker.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ HEADERS += mainwindow.h \
2121

2222
FORMS += mainwindow.ui
2323

24-
ICON = BootableDriveMaker.icns
24+
ICON = icons/BootableDriveMaker.icns

source/guihandler.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
#include "guihandler.h"
22
#include <QFile>
33
#include <QTextStream>
4+
45
guiHandler::guiHandler() : hasFinished(false) {}
56
void guiHandler::run() {
6-
QString content;
7+
QString content, oldBigLog = "";
78
while(!hasFinished) {
89
//Update linelog
910
QFile linelog("currStep.txt");
1011
if (linelog.open(QIODevice::ReadOnly)) {
11-
content = QTextStream(&linelog).readLine();
12-
linelog.close();
13-
emit setLineLog(content);
12+
emit setLineLog(QTextStream(&linelog).readLine());
13+
linelog.close();
1414
}
1515
//Update biglog
1616
QFile biglog("cmdOut.txt");
1717
if (biglog.open(QIODevice::ReadOnly)) {
18-
content = "";
19-
QTextStream in(&biglog);
20-
while(!in.atEnd()) {
21-
content += "\n" + in.readLine();
18+
content = QTextStream(&biglog).readAll();
19+
if (content != oldBigLog) {
20+
oldBigLog = content;
21+
emit setBigLog(content);
22+
msleep(50);
23+
emit autoScroll();
2224
}
2325
biglog.close();
24-
emit setBigLog(content);
2526
}
26-
emit autoScroll();
2727
msleep(200);
2828
}
2929
}
30-
void guiHandler::done(int,QProcess::ExitStatus) {
31-
hasFinished = true;
32-
}
30+
void guiHandler::done(int,QProcess::ExitStatus) { hasFinished = true; }

source/guihandler.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include <QThread>
55
#include <QProcess>
66

7-
class guiHandler : public QThread
8-
{
7+
class guiHandler : public QThread {
98
Q_OBJECT
109
void run();
1110
bool hasFinished;

source/mainwindow.cpp

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
2121
QProcess removeFiles;
2222
removeFiles.start("rm devID.txt currStep.txt cmdOut.txt path.txt file.iso file.img.dmg file.img");
2323
removeFiles.waitForFinished();
24+
QFile findDevs("findDevs.sh");
25+
if (findDevs.exists()) findDevs.resize(0);
26+
if (findDevs.open(QIODevice::WriteOnly)) {
27+
QTextStream out(&findDevs);
28+
out << "diskutil list | grep /dev/disk";
29+
findDevs.close();
30+
}
31+
else {
32+
QMessageBox msgBox;
33+
msgBox.setText("ERROR: Could Not Write To findDevs.sh\nApplication Might Not Be In /Applications Or In Your Desktop Or Documents Folder?");
34+
msgBox.exec();
35+
ui->plainTextEdit->appendPlainText("ERROR: Could Not Write To findDevs.sh\nApplication Might Not Be In /Applications Or In Your Desktop Or Documents Folder?");
36+
setEnabled(false);
37+
}
2438
QStringList itemsToAdd;
2539
itemsToAdd << "1. Ubuntu 16.04 (64-Bit)";
2640
itemsToAdd << "2. Debian 8.6.0 (64-Bit, Internet Installer)";
@@ -35,9 +49,7 @@ MainWindow::~MainWindow() {
3549
delete process;
3650
delete guihandler;
3751
}
38-
void MainWindow::setLineLog(QString str) {
39-
ui->log->setText(str);
40-
}
52+
void MainWindow::setLineLog(QString str) { ui->log->setText(str); }
4153
void MainWindow::setBigLog(QString str) {
4254
ui->plainTextEdit->clear();
4355
ui->plainTextEdit->appendPlainText(str);
@@ -70,7 +82,7 @@ void MainWindow::on_startStop_clicked() {
7082
}
7183
if (ui->devID->currentText().contains("ERROR")) {
7284
ui->plainTextEdit->appendPlainText("Please Put A USB Drive Into The Computer And Refresh The Device List.");
73-
ui->plainTextEdit->appendPlainText("If You Got An Error Saying Something Is Not Right, Do Not Continue, And Email The Developer.");
85+
ui->plainTextEdit->appendPlainText("If You Got An Error Saying Something Is Not Right, Do Not Continue, And Contact The Developer.");
7486
return;
7587
}
7688
if (osPath == "") {
@@ -101,14 +113,27 @@ void MainWindow::on_startStop_clicked() {
101113

102114
//Print osPath to path.txt
103115
QFile location("path.txt");
104-
location.open(QIODevice::WriteOnly);
105-
QTextStream(&location) << osPath;
106-
location.close();
116+
if (location.open(QIODevice::WriteOnly)) {
117+
QTextStream(&location) << osPath;
118+
location.close();
119+
}
120+
else {
121+
ui->log->setText("ERROR While Passing File Path");
122+
ui->plainTextEdit->appendPlainText("\nAn error has occured while passing the file path to the script.");
123+
ui->plainTextEdit->appendPlainText("Application Might Not Be In /Applications Or In Your Desktop Or Documents Folder?");
124+
return;
125+
}
107126
//Print rdisk device to devID.txt
108127
QFile dev("devID.txt");
109-
dev.open(QIODevice::WriteOnly);
110-
QTextStream(&dev) << "/dev/rdisk" << devIDToInt();
111-
dev.close();
128+
if (dev.open(QIODevice::WriteOnly)) {
129+
QTextStream(&dev) << "/dev/rdisk" << devIDToInt();
130+
dev.close();
131+
}
132+
else {
133+
ui->log->setText("ERROR While Passing The Device ID");
134+
ui->plainTextEdit->appendPlainText("\nAn error has occured while passing the Device ID to the script.");
135+
ui->plainTextEdit->appendPlainText("Application Might Not Be In /Applications Or In Your Desktop Or Documents Folder?");
136+
}
112137

113138
process->start("osascript", QStringList() << "-e" << "do shell script \"sh run.sh\" with administrator privileges");
114139
guihandler->start();
@@ -135,16 +160,30 @@ void MainWindow::on_refreshDevs_clicked() {
135160
}
136161
QStringList devs;
137162
QString currLine = "";
138-
for (int i = 0; i < allDevs.length(); ++i) {
139-
QString c = allDevs.at(i);
140-
if (c != ":") {
163+
if (allDevs.contains(":")) {
164+
for (int i = 0; i < allDevs.length(); ++i) {
165+
QString c = allDevs.at(i);
166+
if (c != ":") {
167+
if (c != "\n") {
168+
currLine += c;
169+
}
170+
}
171+
else {
172+
devs.append(currLine);
173+
currLine = "";
174+
}
175+
}
176+
}
177+
else {
178+
for (int i = 0; i < allDevs.length(); ++i) {
179+
QString c = allDevs.at(i);
141180
if (c != "\n") {
142181
currLine += c;
143182
}
144-
}
145-
else {
146-
devs.append(currLine);
147-
currLine = "";
183+
else {
184+
devs.append(currLine);
185+
currLine = "";
186+
}
148187
}
149188
}
150189
if (!ui->allowNonExtern->isChecked()) {

source/mainwindow.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>659</width>
10-
<height>398</height>
9+
<width>675</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -210,7 +210,7 @@
210210
<rect>
211211
<x>0</x>
212212
<y>0</y>
213-
<width>659</width>
213+
<width>675</width>
214214
<height>22</height>
215215
</rect>
216216
</property>
File renamed without changes.

source/scripts/findDevs.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)