From 3f77b9f300a918a598536e22987128f8458ab054 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 20 Oct 2011 23:39:28 +0200 Subject: [PATCH] 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. --- midori/midori-extension.c | 11 ++++++++++- wscript | 14 ++------------ 2 files changed, 12 insertions(+), 13 deletions(-) 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') -- 2.39.5