changeset 211:3f2203e70218

2003-7-6 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - instead of using g_strconcat to build the directory paths, use g_build_path. Fixes a bug when you was connected to a remote host, and you was in /, the path would show up as // (from Krzysztof Foltman <kfoltman@onet.pl>, slightly changed by me)
author masneyb
date Sun, 06 Jul 2003 14:14:34 +0000
parents 82ebd1b05345
children f04f6bedaf19
files ChangeLog lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c
diffstat 5 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jul 06 13:52:43 2003 +0000
+++ b/ChangeLog	Sun Jul 06 14:14:34 2003 +0000
@@ -1,3 +1,10 @@
+2003-7-6 Brian Masney <masneyb@gftp.org>
+	* lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c -
+	instead of using g_strconcat to build the directory paths, use
+	g_build_path. Fixes a bug when you was connected to a remote host,
+	and you was in /, the path would show up as // 
+	(from Krzysztof Foltman <kfoltman@onet.pl>, slightly changed by me)
+
 2003-7-6 Brian Masney <masneyb@gftp.org>
 	* lib/pty.c lib/gftp.h - added gftp_exec_with_new_pty() and
 	gftp_exec_without_new_pty()
@@ -1181,7 +1188,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.106 2003/07/06 13:52:42 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.107 2003/07/06 14:14:33 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/protocols.c	Sun Jul 06 13:52:43 2003 +0000
+++ b/lib/protocols.c	Sun Jul 06 14:14:34 2003 +0000
@@ -1540,9 +1540,13 @@
         fle->startsize = *newsize;
 
       if (transfer->toreq)
-        fle->destfile = g_strconcat (transfer->toreq->directory, "/", 
-                                     fle->file, NULL);
-      newname = g_strconcat (transfer->fromreq->directory, "/", fle->file, NULL);
+        fle->destfile = g_build_path (G_DIR_SEPARATOR_S, 
+                                      transfer->toreq->directory, fle->file, 
+                                      NULL);
+
+      newname = g_build_path (G_DIR_SEPARATOR_S, transfer->fromreq->directory,
+			     fle->file, NULL);
+
       g_free (fle->file);
       fle->file = newname;
 
@@ -2508,4 +2512,3 @@
 
   return (fd);
 }
-
--- a/lib/sshv2.c	Sun Jul 06 13:52:43 2003 +0000
+++ b/lib/sshv2.c	Sun Jul 06 14:14:34 2003 +0000
@@ -1626,7 +1626,8 @@
   else
     {
       oldlen = strlen (request->directory) + strlen (oldname) + 1;
-      oldstr = g_strconcat (request->directory, "/", oldname, NULL);
+      oldstr = g_build_path (G_DIR_SEPARATOR_S, request->directory, oldname, 
+                             NULL);
     }
 
   if (*newname == '/')
@@ -1637,7 +1638,8 @@
   else
     {
       newlen = strlen (request->directory) + strlen (newname) + 1;
-      newstr = g_strconcat (request->directory, "/", newname, NULL);
+      newstr = g_build_path (G_DIR_SEPARATOR_S, request->directory, newname, 
+                             NULL);
     }
 
   tempstr = g_malloc (oldlen + newlen + 13);
@@ -2262,4 +2264,3 @@
 
   return (gftp_set_config_options (request));
 }
-
--- a/src/gtk/dnd.c	Sun Jul 06 13:52:43 2003 +0000
+++ b/src/gtk/dnd.c	Sun Jul 06 14:14:34 2003 +0000
@@ -79,7 +79,8 @@
   newfle->file = g_strdup (current_ftpdata->directory);
   *(pos - 1) = '\0';
   
-  newfle->destfile = g_strconcat (wdata->request->directory, "/", pos, NULL);
+  newfle->destfile = g_build_path (G_DIR_SEPARATOR_S, wdata->request->directory, pos, 
+                                   NULL);
   templist = g_malloc0 (sizeof (*templist));
   templist->data = newfle;
   templist->next = NULL;
@@ -243,4 +244,3 @@
 
   gtk_drag_finish (context, finish_drag, FALSE, clk_time);
 }
-
--- a/src/gtk/menu-items.c	Sun Jul 06 13:52:43 2003 +0000
+++ b/src/gtk/menu-items.c	Sun Jul 06 14:14:34 2003 +0000
@@ -533,10 +533,15 @@
   templist = get_next_selection (templist, &filelist, &num);
   tempfle = filelist->data;
 
-  newdir = g_strconcat (wdata->request->directory, "/", tempfle->file, NULL);
-  remove_double_slashes (newdir);
+  newdir = g_build_path (G_DIR_SEPARATOR_S, wdata->request->directory, 
+                         tempfle->file, NULL);
+
   if ((tempstr = expand_path (newdir)) == NULL)
-    return (0);
+    {
+      g_free (newdir);
+      return (0);
+    }
+
   g_free (newdir);
 
   if (check_reconnect (wdata) < 0)
@@ -999,4 +1004,3 @@
       curlist = curlist->next;
     }
 }
-