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.
This commit is contained in:
Christian Dywan 2011-10-20 23:39:28 +02:00
parent b29ee13da6
commit 3f77b9f300
2 changed files with 12 additions and 13 deletions

View file

@ -294,7 +294,16 @@ midori_extension_activate_cb (MidoriExtension* extension,
if (error->code == G_FILE_ERROR_NOENT) if (error->code == G_FILE_ERROR_NOENT)
{ {
gchar* filename = g_object_get_data (G_OBJECT (extension), "filename"); 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, katze_assign (config_file,
sokoke_find_config_filename (folder, "config")); sokoke_find_config_filename (folder, "config"));
g_free (folder); g_free (folder);

14
wscript
View file

@ -476,23 +476,13 @@ def build (bld):
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.js')
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css')
# FIXME: Determine the library naming for other platforms if 1:
if bld.env['platform'] == 'win32':
extensions = os.listdir ('data/extensions') extensions = os.listdir ('data/extensions')
for extension in extensions: for extension in extensions:
folder = 'lib' + extension + '.dll'
source = 'data/extensions/' + extension + '/config' source = 'data/extensions/' + extension + '/config'
if os.path.exists (source): if os.path.exists (source):
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \ bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \
'/extensions/' + folder, source) '/extensions/' + extension, 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)
if Options.commands['check'] or bld.env['tests']: if Options.commands['check'] or bld.env['tests']:
bld.add_subdirs ('tests') bld.add_subdirs ('tests')