--- linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp 2012/08/05 13:21:12 2359 +++ linuxsampler/trunk/src/hostplugins/lv2/PluginLv2.cpp 2012/08/16 17:01:35 2360 @@ -18,6 +18,8 @@ * MA 02110-1301 USA * ***************************************************************************/ +#define _BSD_SOURCE 1 /* for realpath() */ + #include #include #include @@ -118,6 +120,23 @@ dmsg(2, ("linuxsampler: Deactivate\n")); } + static String RealPath(const String& path) + { + String out = path; + char* cpath = NULL; +#ifdef _WIN32 + cpath = (char*)malloc(MAX_PATH); + GetFullPathName(path.c_str(), MAX_PATH, cpath, NULL); +#else + cpath = realpath(path.c_str(), NULL); +#endif + if (cpath) { + out = cpath; + free(cpath); + } + return out; + } + String PluginLv2::PathToState(const String& path) { if (MapPath) { char* cstr = MapPath->abstract_path(MapPath->handle, path.c_str()); @@ -131,9 +150,10 @@ String PluginLv2::PathFromState(const String& path) { if (MapPath) { char* cstr = MapPath->absolute_path(MapPath->handle, path.c_str()); - const String abstract_path(cstr); + // Resolve symbolic links so SFZ sample paths load correctly + const String absolute_path(RealPath(cstr)); free(cstr); - return abstract_path; + return absolute_path; } return path; }