Add utility function to get windows packaging directory to avoid memory leaks
There were a few other small leaks in pbd and evoral test code but I didn't bother changing them. Perhaps this function would be better off in PBD:: so it can be used everywhere.
This commit is contained in:
parent
1d05b5d25d
commit
36e4c11a2a
@ -78,6 +78,13 @@ namespace ARDOUR {
|
||||
* @return our 'Windows' search path ( corresponds to <install_dir>/share/ardour3 )
|
||||
*/
|
||||
LIBARDOUR_API PBD::Searchpath windows_search_path ();
|
||||
|
||||
/**
|
||||
* @return Convenience function that calls
|
||||
* g_win32_get_package_installation_directory_of_module but returns a
|
||||
* std::string
|
||||
*/
|
||||
LIBARDOUR_API std::string windows_package_directory_path ();
|
||||
#endif
|
||||
} // namespace ARDOUR
|
||||
|
||||
|
@ -200,7 +200,7 @@ std::string
|
||||
ardour_dll_directory ()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
|
||||
std::string dll_dir_path(windows_package_directory_path());
|
||||
dll_dir_path = Glib::build_filename (dll_dir_path, "lib");
|
||||
return Glib::build_filename (dll_dir_path, LIBARDOUR);
|
||||
#else
|
||||
@ -217,10 +217,27 @@ ardour_dll_directory ()
|
||||
Searchpath
|
||||
windows_search_path ()
|
||||
{
|
||||
std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
|
||||
std::string dll_dir_path(windows_package_directory_path());
|
||||
dll_dir_path = Glib::build_filename (dll_dir_path, "share");
|
||||
return Glib::build_filename (dll_dir_path, LIBARDOUR);
|
||||
}
|
||||
|
||||
std::string
|
||||
windows_package_directory_path ()
|
||||
{
|
||||
char* package_dir =
|
||||
g_win32_get_package_installation_directory_of_module (NULL);
|
||||
|
||||
if (package_dir == NULL) {
|
||||
fatal << string_compose (_("Cannot determine %1 package directory"),
|
||||
PROGRAM_NAME) << endmsg;
|
||||
// not reached
|
||||
}
|
||||
|
||||
std::string package_dir_path(package_dir);
|
||||
g_free(package_dir);
|
||||
return package_dir_path;
|
||||
}
|
||||
#endif
|
||||
|
||||
Searchpath
|
||||
|
@ -123,7 +123,7 @@ PluginManager::PluginManager ()
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
// on windows the .exe needs to be in the same folder with libardour.dll
|
||||
vstsp += Glib::build_filename(g_win32_get_package_installation_directory_of_module (0), "bin");
|
||||
vstsp += Glib::build_filename(windows_package_directory_path(), "bin");
|
||||
#else
|
||||
// on Unices additional internal-use binaries are deployed to $libdir
|
||||
vstsp += ARDOUR::ardour_dll_directory();
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/audioengine.h"
|
||||
#include "ardour/filesystem_paths.h"
|
||||
|
||||
#include "test_util.h"
|
||||
|
||||
@ -133,7 +134,7 @@ PBD::Searchpath
|
||||
test_search_path ()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
|
||||
std::string wsp(windows_package_directory_path());
|
||||
return Glib::build_filename (wsp, "ardour_testdata");
|
||||
#else
|
||||
return Glib::getenv("ARDOUR_TEST_PATH");
|
||||
|
Loading…
Reference in New Issue
Block a user