diff --git a/.gitignore b/.gitignore index d22540ef..cb42c66b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /Rack /Rack.exe +/Rack.res /libRack.a /autosave.json /settings.json diff --git a/src/main.cpp b/src/main.cpp index bc17ecb7..45df303a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,13 +6,57 @@ #include "settings.hpp" #include "asset.hpp" #include "bridge.hpp" -#include #include "osdialog.h" +#include + +#if defined(ARCH_WIN) + #include +#else + #include +#endif + using namespace rack; + +std::vector filesystemListDirectory(std::string path) { + std::vector filenames; +#if defined(ARCH_WIN) + WIN32_FIND_DATA findData; + HANDLE findHandle = FindFirstFile((path + "/*").c_str(), &findData); + if (findHandle != INVALID_HANDLE_VALUE) { + do { + std::string filename = findData.cFileName; + if (filename == "." || filename == "..") + continue; + filenames.push_back(path + "/" + filename); + } while (FindNextFile(findHandle, &findData)); + FindClose(findHandle); + } +#else + DIR *dir = opendir(path.c_str()); + if (dir) { + struct dirent *d; + while ((d = readdir(dir))) { + std::string filename = d->f_name; + if (filename == "." || filename == "..") + continue; + filenames.push_back(path + "/" + filename); + } + closedir(dir); + } +#endif + return filenames; +} + int main(int argc, char* argv[]) { + + for (std::string filename : filesystemListDirectory("plugins")) { + debug("%s", filename.c_str()); + } + return 0; + randomInit(); loggerInit();