diff --git a/src/dtbootmenu.cpp b/src/dtbootmenu.cpp index c381488..2bef0da 100644 --- a/src/dtbootmenu.cpp +++ b/src/dtbootmenu.cpp @@ -5,7 +5,7 @@ void scanDisks(int delay) sleep(delay); entries = {}; - Partition("/dev/mmcblk0p8", true).scan({"media/0/boot"}); + Partition("/dev/mmcblk0p8").scan({"media/0/boot"}); for (int disk = 1; fileExists("/dev/mmcblk" + to_string(disk)); disk++) { @@ -16,8 +16,8 @@ void scanDisks(int delay) for (int disk = 0; fileExists((string)"/dev/sd" + (char)('a' + disk)); disk++) { - Partition((string)"/dev/sd" + (char)('a' + (char)disk)).scan(); - for (int part = 1; fileExists("/dev/sd" + (char)('a' + disk) + to_string(part)); part++) + Partition((string)"/dev/sd" + to_string('a' + (char)disk)).scan(); + for (int part = 1; fileExists("/dev/sd" + to_string('a' + disk) + to_string(part)); part++) Partition((string)"/dev/sd" + (char)('a' + disk) + to_string(part)).scan(); } } @@ -42,7 +42,7 @@ int main() detectModel(); - scanDisks(1); + scanDisks(5); ui::mainLoop(); diff --git a/src/partition.cpp b/src/partition.cpp index 1d71fff..8e4cf7c 100644 --- a/src/partition.cpp +++ b/src/partition.cpp @@ -22,6 +22,7 @@ void Partition::scanDir(string dirname) while ((entry = readdir(dir)) != NULL) { string name = entry->d_name; + cout << "Found file " << entry->d_name << ".\n"; if (checkExtension(name, ".dtbootmenu")) { Entry entry = EntryFile(path, dirname, name).parse(); @@ -29,34 +30,30 @@ void Partition::scanDir(string dirname) entries.push_back(entry); } - if (override) + if (checkExtension(name, ".dtb")) { - if (checkExtension(name, ".dtb")) - { - cout << "Unsing external " << name << " from " << path << ".\n"; - saveFile("/" + name, loadFile(dirname + "/" + name)); - } + cout << "Unsing external " << name << " from " << path << ".\n"; + saveFile("/" + name, loadFile(dirname + "/" + name)); } } } } -Partition::Partition(string _path, bool _override) +Partition::Partition(string _path) { path = _path; - override = _override; } void Partition::scan(vector directories) { - //cout << "Scanning " + path + "\n"; + cout << "Scanning " + path + "\n"; if (mount(path.c_str(), "/tmpmount", "ext4", MS_RDONLY, "") == 0) { - //cout << "Found supported file system on " + path + ".\n"; + cout << "Found supported file system on " + path + ".\n"; - for (string d: directories) + for (string &d: directories) { - //cout << "Scanning " + d + " on " + path + "\n"; + cout << "Scanning " + d + " on " + path + "\n"; scanDir("/tmpmount/" + d); } diff --git a/src/partition.h b/src/partition.h index 37e3af3..982da38 100644 --- a/src/partition.h +++ b/src/partition.h @@ -5,12 +5,11 @@ class Partition { private: string path; - bool override; void scanDir(string path); public: - Partition(string _path = "", bool override = false); + Partition(string _path = ""); void scan(vector directories = {"", "boot"}); };