Re: new pre-release: 20040808

David Jensen wrote:
David Jensen wrote:

hmm, patch was stripped, TAKE 2!


more problems, the patch only works when confirm overwrite is on.
worse, the built-in copy is also broken when confirm overwrite is off, probably since version 0.0.7, when i tried to fix the nesting!


this is only when copying a directory that already exists.
i'll work on it

David Jensen
ok, toar fixed the builtin, an i copied that fix to the cpbar plugin
attached patches, all seems ok, testing?
mvbar still needs fixed

David Jensen
diff -Nuar emelfm2-20040808/src/old/callbacks.c emelfm2/src/old/callbacks.c
--- emelfm2-20040808/src/old/callbacks.c        2004-08-07 17:42:50.000000000 
-0500
+++ emelfm2/src/old/callbacks.c 2004-08-08 18:05:03.339378584 -0500
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.5 2004/08/07 22:42:50 cairo Exp $
+/* $Id: callbacks.c,v 1.6 2004/08/08 22:38:14 cairo Exp $
  *
  * Copyright (C) 2003-2004 tooar <tooar@xxxxxxx>
  * Copyright (C) 1999 Michael Clark.
@@ -61,12 +61,13 @@
                                g_snprintf(dest, sizeof(dest), "%s", 
other_view->dir);
                        if (check)
                        {
-                                       result = op_with_ow_check (src, dest, 
file_copy);
+                               result = op_with_ow_check (src, dest, 
file_copy);
                                if (result == YES_TO_ALL)
                                  check = FALSE;
                                else if (result == CANCEL)
                                  break;
-                       }
+                       } else
+                               file_copy (src, dest);
                }
                else
                        file_copy(src, dest);
@@ -159,14 +160,17 @@
                g_snprintf(dest, sizeof(dest), "%s/%s", other_view->dir, 
info->filename);
                if (check && (access(dest, F_OK) == 0))
                {
-                       result = op_with_ow_check(src, dest, file_move);
+                       result = op_with_ow_check(src, other_view->dir, 
file_copy);
+                       file_delete (src);
                        if (result == YES_TO_ALL)
                          check = FALSE;
                        else if (result == CANCEL)
                          break;
+               } else
+               {
+                       file_copy (src, other_view->dir);
+                       file_delete (src);
                }
-               else
-                       file_move(src, dest);
        }
        g_list_free(base);
 
diff -Nuar emelfm2-20040808/src/old/CVS/Entries emelfm2/src/old/CVS/Entries
--- emelfm2-20040808/src/old/CVS/Entries        1969-12-31 18:00:00.000000000 
-0600
+++ emelfm2/src/old/CVS/Entries 2004-08-08 18:05:03.339378584 -0500
@@ -0,0 +1,6 @@
+/filelist.c/1.4/Wed Jul 14 23:20:05 2004//
+/fileview.c/1.4/Wed Jul 14 23:20:05 2004//
+/plugins.c/1.1/Sat May  8 13:54:25 2004//
+/callbacks.c/1.6/Sun Aug  8 22:42:18 2004//
+/fileops.c/1.3/Sun Aug  8 22:42:19 2004//
+D
diff -Nuar emelfm2-20040808/src/old/CVS/Repository 
emelfm2/src/old/CVS/Repository
--- emelfm2-20040808/src/old/CVS/Repository     1969-12-31 18:00:00.000000000 
-0600
+++ emelfm2/src/old/CVS/Repository      2004-08-08 18:05:03.338378736 -0500
@@ -0,0 +1 @@
+emelfm2/src/old
diff -Nuar emelfm2-20040808/src/old/CVS/Root emelfm2/src/old/CVS/Root
--- emelfm2-20040808/src/old/CVS/Root   1969-12-31 18:00:00.000000000 -0600
+++ emelfm2/src/old/CVS/Root    2004-08-08 18:05:03.338378736 -0500
@@ -0,0 +1 @@
+:pserver:anonymous@xxxxxxxxxxxxxx:/cvsroot/emelfm2
diff -Nuar emelfm2-20040808/src/old/fileops.c emelfm2/src/old/fileops.c
--- emelfm2-20040808/src/old/fileops.c  2004-06-29 10:24:20.000000000 -0500
+++ emelfm2/src/old/fileops.c   2004-08-08 18:05:03.339378584 -0500
@@ -1,5 +1,5 @@
 /*
- * $Id: fileops.c,v 1.2 2004/06/29 15:24:20 cairo Exp $
+ * $Id: fileops.c,v 1.3 2004/08/08 22:38:14 cairo Exp $
  *
  * Copyright (C) 2003 tooar <tooar@xxxxxxx>
  * Copyright (C) 1999 Michael Clark.
@@ -116,27 +116,6 @@
        return 0;
 }
 
-/*
-gint file_mount(gchar *mount_point)
-{
-       gchar *quote = g_shell_quote (mount_point);
-       gchar *command = g_strconcat ("mount ", quote, NULL);
-       e2_command_run (command, E2_COMMAND_RANGE_FILE_OPERATION);
-       g_free (command);
-       g_free (quote);
-       return 0;
-}
-
-gint file_umount(gchar *mount_point)
-{
-       gchar *quote = g_shell_quote (mount_point);
-       gchar *command = g_strconcat ("umount ", quote, NULL);
-       e2_command_run (command, E2_COMMAND_RANGE_FILE_OPERATION);
-       g_free (command);
-       g_free (quote);
-       return 0;
-}
-*/
 gint file_mkdir(gchar *path)
 {
        return mkdir(path, 0777);
--- emelfm2-20040808.orig/plugins/cpbar.c       2004-08-08 14:29:01.574866304 
-0500
+++ emelfm2/plugins/cpbar.c     2004-08-08 18:24:51.487752576 -0500
@@ -333,14 +333,14 @@
        {
                i += 1;
                g_snprintf(dest, sizeof(dest), "%s/%s", dest_dir,
-                               ((FileInfo *)const_list->data)->filename);
+                               (gchar *) const_list->data);
                g_snprintf(src, sizeof(src), "%s/%s", src_dir,
-                               ((FileInfo *)const_list->data)->filename);
+                               (gchar *) const_list->data);
                g_snprintf(command, sizeof(command), "cp -rf \"%s\" \"%s\"", 
src, dest);
                progbarstruct.currname = dest;
 
                
-               if (check && (access(dest, F_OK) == 0))
+               if (access(dest, F_OK) == 0)
                {
                        if ((s = strrchr(dest, '/')) != NULL)
                                s++;
@@ -349,42 +349,51 @@
 
                        gchar *utf = _STR2UTF (s);
                        
-                       gchar dialog_text[MAX_LEN];
-                       g_snprintf (dialog_text, sizeof (dialog_text),
-                               "are you sure you want to overwrite 
<b><u>%s</u></b>?", utf);
-                       GtkWidget *dialog;
-                       dialog = create_confirm_dialog (dialog_text,
-                               (E2_BUTTON_CANCEL | E2_BUTTON_NO |
-                                E2_BUTTON_YES_TO_ALL | E2_BUTTON_YES));
-                       gint result = gtk_dialog_run (GTK_DIALOG (dialog));
-                       g_free (utf);
-                       gtk_widget_destroy (dialog);
-
-                       switch (result)
+                       struct stat statbuf;
+                       lstat(dest, &statbuf);
+                       if (S_ISDIR(statbuf.st_mode))
+                               g_snprintf(command, sizeof(command),
+                                               "cp -rf \"%s\" \"%s\"", src, 
dest_dir);
+                       if (check)
                        {
-                               case 111:
-                                       //apply is yes to all
-                                       check = FALSE;
-                               case GTK_RESPONSE_YES:
-                                       progbarstruct.process_id = 
exec_and_capture_output_threaded_progbar(command);   
-                                       gtk_widget_show(window);
-                               case GTK_RESPONSE_NO:
-                               default:
-                                       //CANCEL
+                               gchar dialog_text[MAX_LEN];
+                               g_snprintf (dialog_text, sizeof (dialog_text),
+                                       "are you sure you want to overwrite 
<b><u>%s</u></b>?", utf);
+                               GtkWidget *dialog;
+                               dialog = create_confirm_dialog (dialog_text,
+                                       (E2_BUTTON_CANCEL | E2_BUTTON_NO |
+                                        E2_BUTTON_YES_TO_ALL | E2_BUTTON_YES));
+                               gint result = gtk_dialog_run (GTK_DIALOG 
(dialog));
+                               gtk_widget_destroy (dialog);
+
+                               switch (result)
+                               {
+                                       case 111:
+                                               //apply is yes to all
+                                               check = FALSE;
+                                       case GTK_RESPONSE_YES:
+                                               progbarstruct.process_id = 
exec_and_capture_output_threaded_progbar(command);   
+                                               gtk_widget_show(window);
+                                       case GTK_RESPONSE_NO:
+                                       default:
+                                               //CANCEL
+                                               break;
+                               }
+                               if (result == GTK_RESPONSE_CANCEL)
                                        break;
-                       }
-                       if (result == GTK_RESPONSE_CANCEL)
-                               break;
-                       else if (result == GTK_RESPONSE_NO)
-                               continue;
-               }
+                               else if (result == GTK_RESPONSE_NO)
+                                       continue;
+                       } else
+                               progbarstruct.process_id = 
exec_and_capture_output_threaded_progbar(command);   
+                       g_free (utf);
+               }
     else
                {
                        progbarstruct.process_id = 
exec_and_capture_output_threaded_progbar(command);   
                        gtk_widget_show(window);
                }
                                
-               shorten((((FileInfo *)const_list->data)->filename), src_dots, 
&src_diff);
+               shorten((gchar *)const_list->data, src_dots, &src_diff);
                shorten(dest_dir, dest_dots, &dest_diff);
 
                while (access(dest, F_OK) == -1)
@@ -400,7 +409,7 @@
                                        "to %s%s" 
                                        "\n"
                                        " copying file/directory %d of %d", 
-                                       src_dots, ((((FileInfo 
*)const_list->data)->filename)+src_diff),
+                                       src_dots, (((gchar 
*)const_list->data)+src_diff),
                                        dest_dots, (dest_dir+dest_diff), 
                                        i, progbarstruct.file_sum);
                        g_snprintf(progbartext, sizeof (progbartext), 

Other related posts: