gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

romLoader.cpp (1159B)


      1 #include "romLoader.h"
      2 
      3 #include "os.h"
      4 
      5 #include "baseLib/filesystem.h"
      6 
      7 namespace synthLib
      8 {
      9 	namespace
     10 	{
     11 		std::set<std::string> g_searchPaths;
     12 	}
     13 
     14 	std::vector<std::string> RomLoader::findFiles(const std::string& _extension, const size_t _minSize, const size_t _maxSize)
     15 	{
     16 		std::vector<std::string> results;
     17 
     18 		if(g_searchPaths.empty())
     19 		{
     20 			g_searchPaths.insert(getModulePath(true));
     21 			g_searchPaths.insert(getModulePath(false));
     22 			g_searchPaths.insert(baseLib::filesystem::getCurrentDirectory());
     23 		}
     24 
     25 		for (const auto& path : g_searchPaths)
     26 			baseLib::filesystem::findFiles(results, path, _extension, _minSize, _maxSize);
     27 
     28 		return results;
     29 	}
     30 
     31 	std::vector<std::string> RomLoader::findFiles(const std::string& _path, const std::string& _extension, const size_t _minSize, const size_t _maxSize)
     32 	{
     33 		if(_path.empty())
     34 			return findFiles(_extension, _minSize, _maxSize);
     35 
     36 		std::vector<std::string> results;
     37 		baseLib::filesystem::findFiles(results, _path, _extension, _minSize, _maxSize);
     38 		return results;
     39 	}
     40 
     41 	void RomLoader::addSearchPath(const std::string& _path)
     42 	{
     43 		g_searchPaths.insert(baseLib::filesystem::validatePath(_path));
     44 	}
     45 }