[totem] main: Handle relative paths to a local instance



commit 6299d99a05f14d1454766e2f5983f34e83bdf988
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 29 01:29:13 2012 +0200

    main: Handle relative paths to a local instance
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643807

 src/totem-object.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index 177f5ae..88db410 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -170,6 +170,27 @@ totem_object_local_command_line (GApplication              *application,
 	        goto bail;
 	}
 
+	/* Replace relative paths with absolute URIs */
+	if (optionstate.filenames != NULL) {
+		guint n_files;
+		int i, n_args;
+
+		n_args = g_strv_length (*arguments);
+		n_files = g_strv_length (optionstate.filenames);
+
+		i = n_args - n_files;
+		for ( ; i < n_args; i++) {
+			char *new_path;
+
+			new_path = totem_create_full_path ((*arguments)[i]);
+			if (new_path == NULL)
+				continue;
+
+			g_free ((*arguments)[i]);
+			(*arguments)[i] = new_path;
+		}
+	}
+
 	g_strfreev (optionstate.filenames);
 	optionstate.filenames = NULL;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]