Fix copy/paste mess in ab298f035ae
[ardour.git] / gtk2_ardour / bundle_env_msvc.cc
index 5e2da98bd4467ce7d8fbe108f8926c63f4af3eb9..97d09c9779dd89a54cddd44fcf4c33d9840b9ef1 100644 (file)
@@ -1,24 +1,25 @@
 /*
-    Copyright (C) 2014 John Emmas
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2014-2017 John Emmas <john@creativepost.co.uk>
+ * Copyright (C) 2015-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include "bundle_env.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 #include <shlobj.h>
 #include <stdlib.h>
@@ -29,7 +30,7 @@
 #include <fstream>
 
 #include <glibmm.h>
-#include <glib/gstdio.h>
+#include "pbd/gstdio_compat.h"
 
 #include <fontconfig/fontconfig.h>
 
@@ -86,7 +87,7 @@ std::string ret;
        if (0 == pExeRoot) {
                pExeRoot = g_build_filename("C:\\", "Program Files", PROGRAM_NAME, 0);
        }
-       
+
        if (pExeRoot) {
                gchar  tmp[PATH_MAX+1];
                gchar* p;
@@ -232,10 +233,11 @@ string fonts_conf_file;
 
 #ifdef DEBUG
        fonts_conf_file = get_module_folder();
-       
+
        if (!fonts_conf_file.empty()) {
                fonts_conf_file += "\\";
                fonts_conf_file += PROGRAM_NAME;
+               fonts_conf_file += PROGRAM_VERSION;
                fonts_conf_file += FONTS_CONF_LOCATION;
 #else
        if (PBD::find_file (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) {
@@ -257,10 +259,11 @@ string pango_modules_file;
 #if defined(DEBUG) || defined(RDC_BUILD)
        // Make sure we pick up the debuggable DLLs !!!
        pango_modules_file = get_module_folder();
-       
+
        if (!pango_modules_file.empty()) {
                pango_modules_file += "\\";
                pango_modules_file += PROGRAM_NAME;
+               pango_modules_file += PROGRAM_VERSION;
                pango_modules_file += PANGO_CONF_LOCATION;
 #if 0
 // JE - handy for non-English locale testing (Greek, in this case)
@@ -295,10 +298,11 @@ string gdk_pixbuf_loaders_file;
 #if defined(DEBUG) || defined(RDC_BUILD)
        // Make sure we pick up the debuggable DLLs !!!
        gdk_pixbuf_loaders_file = get_module_folder();
-       
+
        if (!gdk_pixbuf_loaders_file.empty()) {
                gdk_pixbuf_loaders_file += "\\";
                gdk_pixbuf_loaders_file += PROGRAM_NAME;
+               gdk_pixbuf_loaders_file += PROGRAM_VERSION;
                gdk_pixbuf_loaders_file += PIXBUFLOADERS_CONF_LOCATION;
 #else
        if (PBD::find_file (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) {
@@ -321,10 +325,11 @@ string clearlooks_la_file;
 #if defined(DEBUG) || defined(RDC_BUILD)
        // Make sure we pick up the debuggable DLLs !!!
        clearlooks_la_file = get_module_folder();
-       
+
        if (!clearlooks_la_file.empty()) {
                clearlooks_la_file += "\\";
                clearlooks_la_file += PROGRAM_NAME;
+               clearlooks_la_file += PROGRAM_VERSION;
                clearlooks_la_file += CLEARLOOKS_CONF_LOCATION;
 #else
        if (PBD::find_file (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) {
@@ -341,7 +346,7 @@ string clearlooks_la_file;
 }
 
 void
-fixup_bundle_environment (int argc, char* argv[], const char** localedir)
+fixup_bundle_environment (int argc, char* argv[], string & localedir)
 {
        std::string exec_path = argv[0];
        std::string dir_path  = Glib::path_get_dirname (exec_path);
@@ -373,6 +378,7 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        // Next, set up 'ARDOUR_DATA_PATH'
        path  = get_module_folder() + "\\";
        path += PROGRAM_NAME;
+       path += PROGRAM_VERSION;
        path += "\\share";
        Glib::setenv ("ARDOUR_DATA_PATH", path, true);
 
@@ -386,21 +392,6 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        Glib::setenv ("ARDOUR_CONFIG_PATH", path, true);
 
 
-       // Next, set up 'ARDOUR_PATH'
-       path  = user_config_directory();
-       path  = Glib::path_get_dirname (path);
-       path += G_SEARCHPATH_SEPARATOR;
-       path += windows_search_path().to_string();
-       path += "\\icons;";
-       path += windows_search_path().to_string();
-       path += "\\pixmaps;";
-       path += ardour_data_search_path().to_string();  // In fact, adds both the 'data' search
-       path += G_SEARCHPATH_SEPARATOR;                 // path and our 'config' search path
-       path += dir_path;
-       path += "\\etc";
-       Glib::setenv ("ARDOUR_PATH", path, true);
-
-
        // Next, set up 'ARDOUR_INSTANT_XML_PATH'
        path = user_config_directory();
        Glib::setenv ("ARDOUR_INSTANT_XML_PATH", path, true);
@@ -411,6 +402,10 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        Glib::setenv ("LADSPA_PATH", path, true);
 
 
+       // Next, set up 'SUIL_MODULE_DIR'
+       Glib::setenv ("SUIL_MODULE_DIR", Glib::build_filename(ardour_dll_directory(), "suil"), true);
+
+
        // Next, set up 'VAMP_PATH'
        cstr = getenv ("VAMP_PATH");
        if (cstr) {
@@ -421,6 +416,7 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        }
        path += get_module_folder() + "\\";
        path += PROGRAM_NAME;
+       path += PROGRAM_VERSION;
        path += "\\bin\\vamp";
        path += G_SEARCHPATH_SEPARATOR;
        path += "%ProgramFiles%\\Vamp Plugins";
@@ -446,7 +442,7 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
                Glib::setenv ("GTK_LOCALEDIR", path, true);
 
                // and return the same path to our caller
-               (*localedir) = strdup (path.c_str());
+               localedir = path;
        }
 
 
@@ -463,8 +459,8 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        Glib::setenv ("GTK_PATH", path, true);
 
 
-       // Unset GTK_RC_FILES so that we only load the RC files that we define
-       Glib::unsetenv ("GTK_RC_FILES");
+       // Unset GTK2_RC_FILES so that we only load the RC files that we define
+       Glib::unsetenv ("GTK2_RC_FILES");
 
 
        // and set a '$HOME' environment variable. This variable changes the value returned
@@ -475,13 +471,18 @@ fixup_bundle_environment (int argc, char* argv[], const char** localedir)
        }
 
        fixup_fonts_config();
-       fixup_pango_config();
        fixup_clearlooks_config();
+
+#ifdef DLL_PIXBUF_LOADERS
        fixup_pixbuf_loaders_config();
+#endif
+#ifdef DLL_PANGO_MODULES
+       fixup_pango_config();
+#endif
 }
 
 
-void load_custom_fonts() 
+void load_custom_fonts()
 {
        std::string ardour_mono_file;