From: Christian Dywan Date: Thu, 20 Oct 2011 21:39:28 +0000 (+0200) Subject: Avoid pre- and suffix with extension default configs X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f77b9f300a918a598536e22987128f8458ab054;p=midori Avoid pre- and suffix with extension default configs So this mainly matters to package maintainers, as the configuration files for extensions have pre- and suffix according to library naming of the platform. Basically this only ever worked on Linux and Windows. Now default configs are always installed with plain names. --- diff --git a/midori/midori-extension.c b/midori/midori-extension.c index 4eb83ef7..634462cc 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -294,7 +294,16 @@ midori_extension_activate_cb (MidoriExtension* extension, if (error->code == G_FILE_ERROR_NOENT) { gchar* filename = g_object_get_data (G_OBJECT (extension), "filename"); - gchar* folder = g_strconcat ("extensions/", filename, NULL); + gchar* folder; + if (g_str_has_prefix (filename, "lib")) + filename = &filename[strlen ("len")]; + if (g_str_has_suffix (filename, G_MODULE_SUFFIX)) + filename = g_strndup (filename, + strlen (filename) - strlen ("." G_MODULE_SUFFIX)); + else + filename = g_strdup (filename); + folder = g_strconcat ("extensions/", filename, NULL); + g_free (filename); katze_assign (config_file, sokoke_find_config_filename (folder, "config")); g_free (folder); diff --git a/wscript b/wscript index d8abd157..36051a86 100644 --- a/wscript +++ b/wscript @@ -476,23 +476,13 @@ def build (bld): bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css') - # FIXME: Determine the library naming for other platforms - if bld.env['platform'] == 'win32': + if 1: extensions = os.listdir ('data/extensions') for extension in extensions: - folder = 'lib' + extension + '.dll' source = 'data/extensions/' + extension + '/config' if os.path.exists (source): bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \ - '/extensions/' + folder, source) - elif Options.platform == 'linux': - extensions = os.listdir ('data/extensions') - for extension in extensions: - folder = 'lib' + extension + '.so' - source = 'data/extensions/' + extension + '/config' - if os.path.exists (source): - bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \ - '/extensions/' + folder, source) + '/extensions/' + extension, source) if Options.commands['check'] or bld.env['tests']: bld.add_subdirs ('tests')