mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-20 20:36:01 +01:00
implement a version of fixup_bundle_environment() that works for a linux ardour bundle
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7912 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0149849164
commit
3dfde7f054
1 changed files with 155 additions and 5 deletions
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <cstdlib>
|
||||
#include <signal.h>
|
||||
#include <cerrno>
|
||||
#include <fstream>
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
#include <gtkmm/settings.h>
|
||||
|
|
@ -66,12 +68,11 @@ static const char* localedir = LOCALEDIR;
|
|||
|
||||
#include <mach-o/dyld.h>
|
||||
#include <sys/param.h>
|
||||
#include <fstream>
|
||||
|
||||
extern void set_language_preference (); // cocoacarbon.mm
|
||||
|
||||
void
|
||||
fixup_bundle_environment ()
|
||||
fixup_bundle_environment (int argc, char* argv[])
|
||||
{
|
||||
if (!getenv ("ARDOUR_BUNDLED")) {
|
||||
return;
|
||||
|
|
@ -260,6 +261,157 @@ fixup_bundle_environment ()
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
fixup_bundle_environment (int argc, char* argv[])
|
||||
{
|
||||
if (!getenv ("ARDOUR_BUNDLED")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::ustring exec_path = argv[0];
|
||||
cerr << "!! EXEC OF " << exec_path << endl;
|
||||
Glib::ustring dir_path = Glib::path_get_dirname (exec_path);
|
||||
Glib::ustring path;
|
||||
const char *cstr = getenv ("PATH");
|
||||
|
||||
/* ensure that we find any bundled executables (e.g. JACK),
|
||||
and find them before any instances of the same name
|
||||
elsewhere in PATH
|
||||
*/
|
||||
|
||||
path = dir_path;
|
||||
|
||||
path = dir_path;
|
||||
path += "/../etc:";
|
||||
path += dir_path;
|
||||
path += "/../lib/surfaces:";
|
||||
path += dir_path;
|
||||
path += "/../lib/panners:";
|
||||
|
||||
setenv ("ARDOUR_MODULE_PATH", path.c_str(), 1);
|
||||
|
||||
path = get_user_ardour_path ();
|
||||
path += ':';
|
||||
path += dir_path;
|
||||
path += "/../etc/icons:";
|
||||
path += dir_path;
|
||||
path += "/../etc/pixmaps:";
|
||||
path += dir_path;
|
||||
path += "/../share:";
|
||||
path += dir_path;
|
||||
path += "/../etc";
|
||||
|
||||
setenv ("ARDOUR_PATH", path.c_str(), 1);
|
||||
setenv ("ARDOUR_CONFIG_PATH", path.c_str(), 1);
|
||||
setenv ("ARDOUR_DATA_PATH", path.c_str(), 1);
|
||||
|
||||
path = dir_path;
|
||||
path += "/../etc";
|
||||
setenv ("ARDOUR_INSTANT_XML_PATH", path.c_str(), 1);
|
||||
|
||||
cstr = getenv ("LADSPA_PATH");
|
||||
if (cstr) {
|
||||
path = cstr;
|
||||
path += ':';
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
path += dir_path;
|
||||
path += "/../lib/plugins";
|
||||
|
||||
setenv ("LADSPA_PATH", path.c_str(), 1);
|
||||
|
||||
cstr = getenv ("VAMP_PATH");
|
||||
if (cstr) {
|
||||
path = cstr;
|
||||
path += ':';
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
path += dir_path;
|
||||
path += "/../lib";
|
||||
|
||||
setenv ("VAMP_PATH", path.c_str(), 1);
|
||||
|
||||
cstr = getenv ("ARDOUR_CONTROL_SURFACE_PATH");
|
||||
if (cstr) {
|
||||
path = cstr;
|
||||
path += ':';
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
path += dir_path;
|
||||
path += "/../lib/surfaces";
|
||||
|
||||
setenv ("ARDOUR_CONTROL_SURFACE_PATH", path.c_str(), 1);
|
||||
|
||||
cstr = getenv ("LV2_PATH");
|
||||
if (cstr) {
|
||||
path = cstr;
|
||||
path += ':';
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
path += dir_path;
|
||||
path += "/../lib/plugins";
|
||||
|
||||
setenv ("LV2_PATH", path.c_str(), 1);
|
||||
|
||||
path = dir_path;
|
||||
path += "/../lib/clearlooks";
|
||||
|
||||
setenv ("GTK_PATH", path.c_str(), 1);
|
||||
|
||||
if (!ARDOUR::translations_are_disabled ()) {
|
||||
|
||||
path = dir_path;
|
||||
path += "/../shared/locale";
|
||||
|
||||
localedir = strdup (path.c_str());
|
||||
setenv ("GTK_LOCALEDIR", localedir, 1);
|
||||
}
|
||||
|
||||
/* write a pango.rc file and tell pango to use it. we'd love
|
||||
to put this into the Ardour.app bundle and leave it there,
|
||||
but the user may not have write permission. so ...
|
||||
|
||||
we also have to make sure that the user ardour directory
|
||||
actually exists ...
|
||||
*/
|
||||
|
||||
if (g_mkdir_with_parents (ARDOUR::get_user_ardour_path().c_str(), 0755) < 0) {
|
||||
error << string_compose (_("cannot create user ardour folder %1 (%2)"), ARDOUR::get_user_ardour_path(), strerror (errno))
|
||||
<< endmsg;
|
||||
} else {
|
||||
|
||||
Glib::ustring mpath;
|
||||
|
||||
path = Glib::build_filename (ARDOUR::get_user_ardour_path(), "pango.rc");
|
||||
|
||||
std::ofstream pangorc (path.c_str());
|
||||
if (!pangorc) {
|
||||
error << string_compose (_("cannot open pango.rc file %1") , path) << endmsg;
|
||||
} else {
|
||||
mpath = Glib::build_filename (ARDOUR::get_user_ardour_path(), "pango.modules");
|
||||
|
||||
pangorc << "[Pango]\nModuleFiles=";
|
||||
pangorc << mpath << endl;
|
||||
pangorc.close ();
|
||||
}
|
||||
|
||||
setenv ("PANGO_RC_FILE", path.c_str(), 1);
|
||||
|
||||
/* similar for GDK pixbuf loaders, but there's no RC file required
|
||||
to specify where it lives.
|
||||
*/
|
||||
|
||||
mpath = Glib::build_filename (ARDOUR::get_user_ardour_path(), "gdk-pixbuf.loaders");
|
||||
setenv ("GDK_PIXBUF_MODULE_FILE", mpath.c_str(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
|
|
@ -324,9 +476,7 @@ int main (int argc, char* argv[])
|
|||
{
|
||||
vector<Glib::ustring> null_file_list;
|
||||
|
||||
#ifdef __APPLE__
|
||||
fixup_bundle_environment ();
|
||||
#endif
|
||||
fixup_bundle_environment (argc, argv);
|
||||
|
||||
Glib::thread_init();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue