]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) #5320 'can't opena folder with '#' in its name': in gtr_open_file(),...
authorJordan Lee <jordan@transmissionbt.com>
Wed, 24 Jul 2013 17:11:21 +0000 (17:11 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Wed, 24 Jul 2013 17:11:21 +0000 (17:11 +0000)
gtk/util.c

index 3f5180591e59d9e937c9603910528b0d9b301462..fe83f9ef43ba18a4a8a12a8a76e89cd1b0e77324 100644 (file)
@@ -361,21 +361,11 @@ gtr_get_help_uri (void)
 void
 gtr_open_file (const char * path)
 {
-  char * uri;
-
-  if (g_path_is_absolute (path))
-    {
-      uri = g_strdup_printf ("file://%s", path);
-    }
-  else
-    {
-      char * cwd = g_get_current_dir ();
-      uri = g_strdup_printf ("file://%s/%s", cwd, path);
-      g_free (cwd);
-    }
-
+  GFile * file = g_file_new_for_path (path);
+  gchar * uri = g_file_get_uri (file);
   gtr_open_uri (uri);
   g_free (uri);
+  g_object_unref (file);
 }
 
 void