summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-08 19:11:13 +0000
committerDavid Robillard <d@drobilla.net>2011-01-08 19:11:13 +0000
commita7b46a0695acfa55d591b0e5ce585d9f92fdad3e (patch)
tree30d7e670c77568684df23a1e02fcc9a0e271a76c /src
parentd95f3e089619d35873acdad4b79e3f7e0f6ccf15 (diff)
downloadingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.tar.gz
ingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.tar.bz2
ingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.zip
Support via waf for running from the build directory.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2799 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/gui/GladeFactory.cpp35
-rw-r--r--src/gui/ingen_gui.glade4
-rw-r--r--src/gui/wscript11
-rw-r--r--src/ingen/main.cpp2
4 files changed, 34 insertions, 18 deletions
diff --git a/src/gui/GladeFactory.cpp b/src/gui/GladeFactory.cpp
index df000cd8..6036d359 100644
--- a/src/gui/GladeFactory.cpp
+++ b/src/gui/GladeFactory.cpp
@@ -30,24 +30,37 @@ namespace GUI {
Glib::ustring GladeFactory::glade_filename = "";
+inline static bool
+is_readable(const std::string& filename)
+{
+ std::ifstream fs(filename.c_str());
+ const bool fail = fs.fail();
+ fs.close();
+ return !fail;
+}
void
GladeFactory::find_glade_file()
{
- char* env_path = getenv("INGEN_GLADE_PATH");
- if (env_path)
- glade_filename = env_path;
- else
- glade_filename = Shared::data_file_path("ingen_gui.glade");
+ // Try file in bundle (directory where executable resides)
+ glade_filename = Shared::bundle_file_path("ingen_gui.glade");
+ if (is_readable(glade_filename))
+ return;
- ifstream fs(glade_filename.c_str());
- if (fs.fail()) {
- error << "[GladeFactory] Unable to find ingen_gui.glade in " << INGEN_DATA_DIR << endl;
- throw;
+ // Try ENGINE_GLADE_PATH from the environment
+ const char* const env_path = getenv("INGEN_GLADE_PATH");
+ if (env_path && is_readable(env_path)) {
+ glade_filename = env_path;
+ return;
}
- fs.close();
- info << "[GladeFactory] Loading widgets from " << glade_filename.c_str() << endl;
+ // Try the default system installed path
+ glade_filename = Shared::data_file_path("ingen_gui.glade");
+ if (is_readable(glade_filename))
+ return;
+
+ error << "[GladeFactory] Unable to find ingen_gui.glade in " << INGEN_DATA_DIR << endl;
+ throw std::runtime_error("Unable to find glade file");
}
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index 39e5f8bd..6b135a2a 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -1829,7 +1829,9 @@
<widget class="GtkAboutDialog" id="about_win">
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
- <property name="copyright" translatable="yes">Copyright (C) 2005-2008 David Robillard &lt;http://drobilla.net&gt;</property>
+ <property name="program_name">Ingen</property>
+ <property name="version">@INGEN_VERSION@</property>
+ <property name="copyright" translatable="yes">Copyright (C) 2005-2010 David Robillard &lt;http://drobilla.net&gt;</property>
<property name="website">http://drobilla.net/software/ingen</property>
<property name="license" translatable="yes">Licensed under the GNU GPL, Version 2.
diff --git a/src/gui/wscript b/src/gui/wscript
index 5ae04233..40c6a270 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -66,7 +66,10 @@ def build(bld):
XML2
''')
- # GUI runtime files
- bld.install_files('${DATADIR}/ingen', 'ingen_gui.glade')
-
-
+ # Glade XML UI definition
+ bld(features = 'subst',
+ source = 'ingen_gui.glade',
+ target = '../../ingen_gui.glade',
+ install_path = '${DATADIR}/ingen',
+ chmod = 0755,
+ INGEN_VERSION = bld.env['INGEN_VERSION'])
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 8069bd1a..da52e1c2 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -87,10 +87,8 @@ main(int argc, char** argv)
return EXIT_SUCCESS;
}
-#ifdef BUNDLE
// Set bundle path from executable location so resources/modules can be found
Shared::set_bundle_path_from_code((void*)&main);
-#endif
SharedPtr<Shared::EngineInterface> engine_interface;