builder: Warn about bad module names

Putting spaces or slashes in module names is a recipe for
cryptic error from one of the many constructed flatpak
commandlines. Better warn early on, as soon as we see such
a name.
tingping/wmclass
Matthias Clasen 2016-05-27 00:05:55 -04:00
parent 1d8408e381
commit 6d1d9724c5
1 changed files with 4 additions and 0 deletions

View File

@ -199,12 +199,16 @@ builder_module_set_property (GObject *object,
{
BuilderModule *self = BUILDER_MODULE (object);
gchar **tmp;
char *p;
switch (prop_id)
{
case PROP_NAME:
g_clear_pointer (&self->name, g_free);
self->name = g_value_dup_string (value);
if ((p = strchr (self->name, ' ')) ||
(p = strchr (self->name, '/')))
g_printerr ("Module names like '%s' containing '%c' are problematic. Expect errors.\n", self->name, *p);
break;
case PROP_SUBDIR: