comparison src/audlegacy/main.c @ 4877:ab60d53dd965

Use g_filename_to_uri on command line items that do not contain "://" (bug #51)
author John Lindgren <john.lindgren@tds.net>
date Fri, 01 May 2009 19:35:44 -0400
parents b2ee645f3e59
children
comparison
equal deleted inserted replaced
4876:85e71772af79 4877:ab60d53dd965
247 } 247 }
248 248
249 static void 249 static void
250 handle_cmd_line_filenames(gboolean is_running) 250 handle_cmd_line_filenames(gboolean is_running)
251 { 251 {
252 char * working, * absolute, * uri;
252 gchar **filenames = options.filenames; 253 gchar **filenames = options.filenames;
253 #ifdef USE_DBUS 254 #ifdef USE_DBUS
254 DBusGProxy *session = audacious_get_dbus_proxy(); 255 DBusGProxy *session = audacious_get_dbus_proxy();
255 #endif 256 #endif
256 257
259 260
260 gint pos = 0; 261 gint pos = 0;
261 gint i = 0; 262 gint i = 0;
262 GList *fns = NULL; 263 GList *fns = NULL;
263 264
264 for (i = 0; filenames[i] != NULL; i++) 265 working = g_get_current_dir ();
265 { 266 for (i = 0; filenames [i]; i ++) {
266 gchar *filename; 267 if (strstr (filenames [i], "://"))
267 gchar *current_dir = g_get_current_dir(); 268 uri = g_strdup (filenames [i]);
268 269 else if (filenames [i] [0] == '/')
269 if (!strstr(filenames[i], "://")) 270 uri = g_filename_to_uri (filenames [i], 0, 0);
270 { 271 else {
271 if (filenames[i][0] == '/') 272 absolute = g_strdup_printf ("/%s/%s", working, filenames [i]);
272 filename = g_strdup_printf("file:///%s", filenames[i]); 273 uri = g_filename_to_uri (absolute, 0, 0);
273 else 274 g_free (absolute);
274 filename = g_strdup_printf("file:///%s/%s", current_dir, 275 }
275 filenames[i]); 276 fns = g_list_prepend (fns, uri);
276 } 277 }
277 else 278 fns = g_list_reverse (fns);
278 filename = g_strdup(filenames[i]); 279 g_free (working);
279
280 fns = g_list_prepend(fns, filename);
281
282 g_free(current_dir);
283 }
284
285 fns = g_list_reverse(fns);
286 280
287 #ifdef USE_DBUS 281 #ifdef USE_DBUS
288 if (is_running) 282 if (is_running)
289 { 283 {
290 GList *i; 284 GList *i;