* @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
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
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
#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();
#include "ardour/session.h"
#include "ardour/audioengine.h"
+#include "ardour/filesystem_paths.h"
#include "test_util.h"
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");