X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fbundle_env_mingw.cc;h=6ee1e0f7a24be27c66b9346e9fb51965ad761ded;hb=6424a0eab93c85f8b1ff56334f779c1232dfe475;hp=d29c62511391b4380d171b9049f1a5dcd69ac8ff;hpb=9034e58b1594724a527703ffc0e411c1b3f96f06;p=ardour.git diff --git a/gtk2_ardour/bundle_env_mingw.cc b/gtk2_ardour/bundle_env_mingw.cc index d29c625113..6ee1e0f7a2 100644 --- a/gtk2_ardour/bundle_env_mingw.cc +++ b/gtk2_ardour/bundle_env_mingw.cc @@ -18,8 +18,9 @@ */ #include +#include #include "bundle_env.h" -#include "i18n.h" +#include "pbd/i18n.h" #include #include @@ -28,7 +29,6 @@ #include #include -#include // CSIDL_* #include "ardour/ardour.h" #include "ardour/search_paths.h" @@ -36,55 +36,13 @@ #include "pbd/file_utils.h" #include "pbd/epa.h" -#include "pbd/windows_special_dirs.h" using namespace std; using namespace PBD; using namespace ARDOUR; - -/* query top-level Ardour installation path. - * Typically, this will be somehwere like - * "C:\Program Files (x86)\Ardour" - */ -const std::string -get_install_path () -{ - const gchar* pExeRoot = g_win32_get_package_installation_directory_of_module (0); - - if (0 == pExeRoot) { - HKEY key; - DWORD size = PATH_MAX; - char tmp[PATH_MAX+1]; - if ( -#ifdef __MINGW64__ - (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Ardour\\ardour3\\w64", 0, KEY_READ, &key)) -#else - (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Ardour\\ardour3\\w32", 0, KEY_READ, &key)) -#endif - &&(ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast(tmp), &size)) - ) - { - pExeRoot = Glib::locale_to_utf8(tmp).c_str(); - } - } - - if (0 == pExeRoot) { - const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES); - if (program_files) { - pExeRoot = g_build_filename(program_files, PROGRAM_NAME, NULL); - } - } - - if (pExeRoot && Glib::file_test(pExeRoot, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) { - return std::string (pExeRoot); - } - return ""; -} - - void -fixup_bundle_environment (int, char* [], const char** localedir) +fixup_bundle_environment (int, char* [], string & localedir) { EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true)); /* what to do ? */ @@ -92,11 +50,20 @@ fixup_bundle_environment (int, char* [], const char** localedir) // setting a FONTCONFIG_FILE won't hurt either see bundle_env_msvc.cc // (pangocairo prefers the windows gdi backend unless PANGOCAIRO_BACKEND=fc is set) - // Unset GTK_RC_FILES so that only ardour specific files are loaded - Glib::unsetenv ("GTK_RC_FILES"); - + // Unset GTK2_RC_FILES so that only ardour specific files are loaded + Glib::unsetenv ("GTK2_RC_FILES"); std::string path; + + if (ARDOUR::translations_are_enabled ()) { + path = windows_search_path().to_string(); + path += "\\locale"; + Glib::setenv ("GTK_LOCALEDIR", path, true); + + // and return the same path to our caller + localedir = path; + } + const char *cstr; cstr = getenv ("VAMP_PATH"); if (cstr) { @@ -105,12 +72,23 @@ fixup_bundle_environment (int, char* [], const char** localedir) } else { path = ""; } - path += Glib::build_filename(get_install_path(), "lib", "ardour3", "vamp", NULL); + path += Glib::build_filename(ardour_dll_directory(), "vamp"); path += G_SEARCHPATH_SEPARATOR; path += "%ProgramFiles%\\Vamp Plugins"; // default vamp path path += G_SEARCHPATH_SEPARATOR; path += "%COMMONPROGRAMFILES%\\Vamp Plugins"; Glib::setenv ("VAMP_PATH", path, true); + + Glib::setenv ("SUIL_MODULE_DIR", Glib::build_filename(ardour_dll_directory(), "suil"), true); + + /* XXX this should really be PRODUCT_EXE see tools/x-win/package.sh + * ardour on windows does not have a startup wrapper script. + * + * then again, there's probably nobody using NSM on windows. + * because neither nsmd nor the GUI is currently available for windows. + * furthermore it'll be even less common for derived products. + */ + Glib::setenv ("ARDOUR_SELF", Glib::build_filename(ardour_dll_directory(), "ardour.exe"), true); } static __cdecl void