/[svn]/linuxsampler/trunk/src/plugins/InstrumentEditorFactory.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/plugins/InstrumentEditorFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1951 by persson, Wed Jul 29 15:31:09 2009 UTC revision 2053 by schoenebeck, Wed Jan 27 20:29:36 2010 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2007 - 2009 Christian Schoenebeck                       *   *   Copyright (C) 2007 - 2010 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 101  namespace LinuxSampler { Line 101  namespace LinuxSampler {
101      void InstrumentEditorFactory::LoadPlugins() {      void InstrumentEditorFactory::LoadPlugins() {
102          if (!bPluginsLoaded) {          if (!bPluginsLoaded) {
103              dmsg(1,("Loading instrument editor plugins..."));              dmsg(1,("Loading instrument editor plugins..."));
104                // getenv() is available on Posix and Windows
105                char* pcPluginDir = getenv("LINUXSAMPLER_PLUGIN_DIR");
106              #if defined(WIN32)              #if defined(WIN32)
107              String dir = Sampler::GetInstallDir();              String installDir = Sampler::GetInstallDir();
108                String pluginDir;
109                if (pcPluginDir)
110                    pluginDir = pcPluginDir;
111                if (pluginDir.empty())
112                    pluginDir = installDir + "\\plugins";
113    
114              // Put the LS installation directory first in DLL search              // Put the LS installation directory first in DLL search
115              // path, so the plugin finds for example the bundled GTK              // path, so the plugin finds for example the bundled GTK
116              // libraries before any other installed versions              // libraries before any other installed versions
117              if (!dir.empty()) {              if (!installDir.empty()) {
118                  // The SetDllDirectory function is only available on                  // The SetDllDirectory function is only available on
119                  // XP and higher, so we call it dynamically                  // XP and higher, so we call it dynamically
120                  HMODULE k32 = GetModuleHandleA("kernel32.dll");                  HMODULE k32 = GetModuleHandleA("kernel32.dll");
# Line 115  namespace LinuxSampler { Line 122  namespace LinuxSampler {
122                      BOOL WINAPI (*setDllDirectory)(LPCSTR) =                      BOOL WINAPI (*setDllDirectory)(LPCSTR) =
123                          (BOOL WINAPI (*)(LPCSTR))GetProcAddress(k32, "SetDllDirectoryA");                          (BOOL WINAPI (*)(LPCSTR))GetProcAddress(k32, "SetDllDirectoryA");
124                      if (setDllDirectory) {                      if (setDllDirectory) {
125                          setDllDirectory(dir.c_str());                          setDllDirectory(installDir.c_str());
126                      }                      }
127                  }                  }
128              }              }
129    
130              if (dir.empty() || !LoadPlugins(dir + "\\plugins")) {              if (pluginDir.empty() || !LoadPlugins(pluginDir)) {
131                  if (!LoadPlugins(CONFIG_PLUGIN_DIR)) {                  if (!LoadPlugins(CONFIG_PLUGIN_DIR)) {
132                      std::cerr << "Could not open instrument editor plugins "                      std::cerr << "Could not open instrument editor plugins "
133                                << "directory (" << dir << "\\plugins or "                                << "directory ('" << pluginDir << "' or '"
134                                << CONFIG_PLUGIN_DIR << "), Error: "                                << CONFIG_PLUGIN_DIR << "'), Error: "
135                                << GetLastError() << std::endl;                                << GetLastError() << std::endl;
136                      return;                      return;
137                  }                  }
138              }              }
139              #else              #else
140              if (!LoadPlugins(CONFIG_PLUGIN_DIR)) {              String dir;
141                if (pcPluginDir)
142                    dir = pcPluginDir;
143                if (dir.empty())
144                    dir = CONFIG_PLUGIN_DIR;
145                if (!LoadPlugins(dir)) {
146                  std::cerr << "Could not open instrument editor plugins "                  std::cerr << "Could not open instrument editor plugins "
147                            << "directory (" << CONFIG_PLUGIN_DIR << "): "                            << "directory ('" << dir << "'): "
148                            << strerror(errno) << std::endl;                            << strerror(errno) << std::endl;
149                  return;                  return;
150              }              }

Legend:
Removed from v.1951  
changed lines
  Added in v.2053

  ViewVC Help
Powered by ViewVC