From 76e346c8e5ac7067cc49063e0c11d88c23871115 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 2 Oct 2018 13:24:45 +0200 Subject: Add Util namespace - Util::files lists files in specified .path --- src/plugin.h | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'src/plugin.h') diff --git a/src/plugin.h b/src/plugin.h index 4de3407..e43215b 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -39,55 +39,4 @@ inline Plugin loadPluginFromPath(const QString &path) return p; } -inline QVector loadPlugins(const QString &path) -{ - QVector list; - - // quit if there's nothing to load - if(path.isEmpty()) - return list; - - // plugins can be a semicolon-separated list - if(path.contains(';')) { - auto pluginList = path.split(';'); - for(const auto &pluginPath : pluginList) { - auto plugin = loadPluginFromPath(pluginPath); - if(plugin.instance) - list.append(plugin); - } - - return list; - } - - // check if path is path to a file or a folder - QFileInfo location(path); - - if(!location.exists()) { - qDebug("Plugin path doesn't exist."); - return list; - } - - if(location.isFile()) { - // only load this one plugin - auto p = loadPluginFromPath(location.absoluteFilePath()); - if(p.instance) - list.append(p); - - } else if(location.isDir()) { - // load all profiles from this directory - const auto entries = QDir(location.absoluteFilePath()).entryInfoList(QDir::Files | QDir::Readable); - for(const auto &f : entries) { - auto p = loadPluginFromPath(f.absoluteFilePath()); - if(p.instance) - list.append(p); - } -#ifdef QT_DEBUG - } else { - qDebug("Path is neither file nor folder: %s", qUtf8Printable(path)); -#endif - } - - return list; -} - #endif // SMOLBOTE_PLUGIN_H -- cgit v1.2.1