at 16.09-beta 50 lines 1.7 kB view raw
1Index: linuxsampler-r2359/src/hostplugins/lv2/PluginLv2.cpp 2=================================================================== 3--- linuxsampler-r2359/src/hostplugins/lv2/PluginLv2.cpp (revision 2359) 4+++ linuxsampler-r2359/src/hostplugins/lv2/PluginLv2.cpp (working copy) 5@@ -18,6 +18,8 @@ 6 * MA 02110-1301 USA * 7 ***************************************************************************/ 8 9+#define _BSD_SOURCE 1 /* for realpath() */ 10+ 11 #include <algorithm> 12 #include <cassert> 13 #include <cstdio> 14@@ -118,6 +120,23 @@ 15 dmsg(2, ("linuxsampler: Deactivate\n")); 16 } 17 18+ static String RealPath(const String& path) 19+ { 20+ String out = path; 21+ char* cpath = NULL; 22+#ifdef _WIN32 23+ cpath = (char*)malloc(MAX_PATH); 24+ GetFullPathName(path.c_str(), MAX_PATH, cpath, NULL); 25+#else 26+ cpath = realpath(path.c_str(), NULL); 27+#endif 28+ if (cpath) { 29+ out = cpath; 30+ free(cpath); 31+ } 32+ return out; 33+ } 34+ 35 String PluginLv2::PathToState(const String& path) { 36 if (MapPath) { 37 char* cstr = MapPath->abstract_path(MapPath->handle, path.c_str()); 38@@ -131,9 +150,10 @@ 39 String PluginLv2::PathFromState(const String& path) { 40 if (MapPath) { 41 char* cstr = MapPath->absolute_path(MapPath->handle, path.c_str()); 42- const String abstract_path(cstr); 43+ // Resolve symbolic links so SFZ sample paths load correctly 44+ const String absolute_path(RealPath(cstr)); 45 free(cstr); 46- return abstract_path; 47+ return absolute_path; 48 } 49 return path; 50 }