void ModuleLoader::refreshDirectories(const ProgramLoader &programLoader) { std::unordered_map<std::string, std::string> selected; for(const std::string& directory : directories) { std::vector<std::string> files; getDirContent(directory, files); for(const std::string& file : files) { std::string ext = extension(file); if(ext == "hm" || ext == "hmc") { std::string key = file.substr(0, file.size()-ext.size()-1); selected[key] = directory+key; } } } for(const auto& entry: selected) { addModule(entry.first, new FromFileModule(programLoader.fromFile(entry.second))); } }
//--------------------------------------------------------------------- // checks existance of a remote file bool Server::remoteFileExists(bstring const & remotePath) { bstring path; bstring file = splitPath(path, remotePath); my_fxp_names * dir = getDirContent(path); if (!dir) return true; for (int i = 0; i < dir->nnames; ++i) { bchar const * const name = dir->names[i]->filename; if (file == name) { return true; } } return false; }