~ted/ubuntu-app-launch/second-exec-quotes

« back to all changes in this revision

Viewing changes to second-exec-core.c

  • Committer: Ted Gould
  • Date: 2013-12-05 12:01:19 UTC
  • Revision ID: ted@gould.cx-20131205120119-jyezaxtnw9t24wxu
Use the parse instead of just splitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
                return;
96
96
        }
97
97
 
98
 
        /* TODO: Joining only with space could cause issues with breaking them
99
 
           back out.  We don't have any cases of more than one today.  But, this
100
 
           isn't good.
101
 
           https://bugs.launchpad.net/upstart-app-launch/+bug/1229354
102
 
           */
103
98
        GVariant * uris = NULL;
104
 
        gchar ** uri_split = g_strsplit(input_uris, " ", 0);
105
 
        if (uri_split[0] == NULL) {
106
 
                g_free(uri_split);
 
99
        gchar ** uri_split = NULL;
 
100
        GError * error = NULL;
 
101
 
 
102
        g_shell_parse_argv(input_uris, NULL, &uri_split, &error);
 
103
 
 
104
        if (uri_split == NULL || uri_split[0] == NULL || error != NULL) {
 
105
                if (error != NULL) {
 
106
                        g_warning("Unable to parse URLs '%s': %s", input_uris, error->message);
 
107
                        g_error_free(error);
 
108
                }
 
109
 
107
110
                uris = g_variant_new_array(G_VARIANT_TYPE_STRING, NULL, 0);
 
111
 
 
112
                if (uri_split != NULL) {
 
113
                        g_strfreev(uri_split);
 
114
                }
108
115
        } else {
109
116
                GVariantBuilder builder;
110
117
                g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);