diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1c9519b..d6e531e 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -164,6 +164,4 @@ MainWindow::~MainWindow() {
delete channel;
delete m_file;
delete reload;
-
- system(("rm -f " + QRC_FILE).c_str());
}
diff --git a/resgen.cpp b/resgen.cpp
index 6f6d47a..73e6ab6 100644
--- a/resgen.cpp
+++ b/resgen.cpp
@@ -9,15 +9,18 @@
using namespace std;
-void read_directory(ofstream *outfile, int depth, string path) {
+bool read_directory(ofstream *outfile, int depth, string path) {
+ int status = false;
for (const auto &entry : filesystem::directory_iterator(path)) {
if (entry.is_directory() && depth < 2)
read_directory(outfile, depth + 1, entry.path());
if (entry.path().string().ends_with(".png")) {
+ status = true;
*outfile << "" << entry.path().string() << "" << endl;
break;
}
}
+ return status;
}
void res_gen(string path) {
@@ -26,7 +29,7 @@ void res_gen(string path) {
outfile << "" << endl;
outfile << "" << endl;
- read_directory(&outfile, 0, path);
+ bool image_exists = read_directory(&outfile, 0, path);
outfile << "" << endl;
outfile << "" << endl;
@@ -34,6 +37,7 @@ void res_gen(string path) {
outfile.close();
// Clean up
- system(("rcc -binary images.qrc -o " + QRC_FILE).c_str());
+ if (image_exists)
+ system(("rcc -binary images.qrc -o " + QRC_FILE).c_str());
system("rm -f images.qrc");
}