LCOV - code coverage report
Current view: top level - muse/framework/vst/internal - vstpluginsscanner.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 28 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #include "vstpluginsscanner.h"
      24              : 
      25              : #include "vst/vsttypes.h"
      26              : 
      27              : #include "log.h"
      28              : 
      29              : using namespace muse;
      30              : using namespace muse::vst;
      31              : 
      32              : /**
      33              :  * @brief Scanning for plugins in the default VST locations, considering the current architecture (i386, x86_64, arm, etc.)
      34              :  * @see https://developer.steinberg.help/pages/viewpage.action?pageId=9798275
      35              :  **/
      36              : namespace muse::vst {
      37            0 : static std::set<io::path_t> pluginPathsFromDefaultLocation()
      38              : {
      39            0 :     std::set<io::path_t> result;
      40              : 
      41              :     try {
      42            0 :         PluginModule::PathList paths = PluginModule::getModulePaths();
      43            0 :         for (const std::string& path : paths) {
      44            0 :             result.insert(path);
      45              :         }
      46            0 :     } catch (...) {
      47            0 :         LOGE() << "Unable to get module paths";
      48            0 :     }
      49              : 
      50            0 :     return result;
      51            0 : }
      52              : }
      53              : 
      54            0 : io::paths_t VstPluginsScanner::scanPlugins(Progress*) const
      55              : {
      56            0 :     TRACEFUNC;
      57              : 
      58            0 :     std::set<io::path_t> unique = pluginPathsFromDefaultLocation();
      59            0 :     std::set<io::path_t> custom = pluginPathsFromCustomLocations(configuration()->userVstDirectories());
      60            0 :     unique.insert(custom.begin(), custom.end());
      61              : 
      62            0 :     return { unique.begin(), unique.end() };
      63            0 : }
      64              : 
      65            0 : std::set<io::path_t> VstPluginsScanner::pluginPathsFromCustomLocations(const io::paths_t& customPaths) const
      66              : {
      67            0 :     std::set<io::path_t> result;
      68              : 
      69            0 :     for (const io::path_t& path : customPaths) {
      70            0 :         RetVal<io::paths_t> paths = fileSystem()->scanFiles(path, { VST3_PACKAGE_FILTER });
      71            0 :         if (!paths.ret) {
      72            0 :             LOGE() << paths.ret.toString();
      73            0 :             continue;
      74              :         }
      75              : 
      76            0 :         result.insert(paths.val.begin(), paths.val.end());
      77            0 :     }
      78              : 
      79            0 :     return result;
      80            0 : }
        

Generated by: LCOV version 2.0-1