/[svn]/linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp

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

revision 2359 by persson, Sun Jul 8 14:44:47 2012 UTC revision 2360 by persson, Thu Aug 16 17:01:35 2012 UTC
# Line 18  Line 18 
18   *   MA  02110-1301  USA                                                   *   *   MA  02110-1301  USA                                                   *
19   ***************************************************************************/   ***************************************************************************/
20    
21    #define _BSD_SOURCE 1  /* for realpath() */
22    
23  #include <algorithm>  #include <algorithm>
24  #include <cassert>  #include <cassert>
25  #include <cstdio>  #include <cstdio>
# Line 118  namespace { Line 120  namespace {
120          dmsg(2, ("linuxsampler: Deactivate\n"));          dmsg(2, ("linuxsampler: Deactivate\n"));
121      }      }
122    
123        static String RealPath(const String& path)
124        {
125            String out   = path;
126            char*  cpath = NULL;
127    #ifdef _WIN32
128            cpath = (char*)malloc(MAX_PATH);
129            GetFullPathName(path.c_str(), MAX_PATH, cpath, NULL);
130    #else
131            cpath = realpath(path.c_str(), NULL);
132    #endif
133            if (cpath) {
134                out = cpath;
135                free(cpath);
136            }
137            return out;
138        }
139    
140      String PluginLv2::PathToState(const String& path) {      String PluginLv2::PathToState(const String& path) {
141          if (MapPath) {          if (MapPath) {
142              char* cstr = MapPath->abstract_path(MapPath->handle, path.c_str());              char* cstr = MapPath->abstract_path(MapPath->handle, path.c_str());
# Line 131  namespace { Line 150  namespace {
150      String PluginLv2::PathFromState(const String& path) {      String PluginLv2::PathFromState(const String& path) {
151          if (MapPath) {          if (MapPath) {
152              char* cstr = MapPath->absolute_path(MapPath->handle, path.c_str());              char* cstr = MapPath->absolute_path(MapPath->handle, path.c_str());
153              const String abstract_path(cstr);              // Resolve symbolic links so SFZ sample paths load correctly
154                const String absolute_path(RealPath(cstr));
155              free(cstr);              free(cstr);
156              return abstract_path;              return absolute_path;
157          }          }
158          return path;          return path;
159      }      }

Legend:
Removed from v.2359  
changed lines
  Added in v.2360

  ViewVC Help
Powered by ViewVC