[Easytag-mailing] Patch for EasyTAG 0.24 ( -> 0.24b )



Hi,

Here is a new patch for EasyTAG 0.24 to replace the previous one, that wasn't very clean...

Sincerely,
Jerome


--
EasyTAG - Tag editor for MP3 and OGG files
http://easytag.sourceforge.net
--
Jerome COUDERC <j couderc ifrance com>
diff -ruN easytag-0.24/configure easytag-0.24b/configure
--- easytag-0.24/configure	Sat Sep 14 22:01:21 2002
+++ easytag-0.24b/configure	Sun Oct  6 12:05:04 2002
@@ -1373,7 +1373,7 @@
 
 
 PACKAGE=easytag
-VERSION=0.24
+VERSION=0.24b
 
 ALL_LINGUAS="cs de es fr hu it ja nl pl ru sv uk"
 
diff -ruN easytag-0.24/configure.in easytag-0.24b/configure.in
--- easytag-0.24/configure.in	Fri Sep 13 23:08:39 2002
+++ easytag-0.24b/configure.in	Sun Oct  6 12:05:19 2002
@@ -3,7 +3,7 @@
 
 dnl from gettext
 PACKAGE=easytag
-VERSION=0.24
+VERSION=0.24b
 
 dnl -------------------------------
 dnl Translation files
diff -ruN easytag-0.24/easytag.spec easytag-0.24b/easytag.spec
--- easytag-0.24/easytag.spec	Sat Sep 14 22:01:45 2002
+++ easytag-0.24b/easytag.spec	Sun Oct  6 12:05:39 2002
@@ -1,5 +1,5 @@
 %define    name      easytag
-%define    version   0.24
+%define    version   0.24b
 %define    release   1
 %define    prefix    /usr
 
diff -ruN easytag-0.24/src/browser.c easytag-0.24b/src/browser.c
--- easytag-0.24/src/browser.c	Fri Sep 13 23:41:08 2002
+++ easytag-0.24b/src/browser.c	Sun Oct  6 12:10:44 2002
@@ -1594,6 +1594,7 @@
 }
 void Rename_Directory (GtkObject *combobox)
 {
+    DIR   *dir;
     gchar *directory_parent;
     gchar *directory_last_name;
     gchar *directory_new_name;
@@ -1601,7 +1602,6 @@
     gchar *tmp_path;
     gchar *new_path;
     gchar *tmp_path_string;
-    struct stat statbuf;
 
 
     if (!GTK_IS_COMBO(combobox)) return;
@@ -1634,22 +1634,26 @@
     last_path = g_strconcat(directory_parent,directory_last_name,NULL);
     new_path  = g_strconcat(directory_parent,directory_new_name,NULL);
 
-    /* Check if the new directory name doesn't already exists, and detect if it's only a case change (needs for vfat) */
-    stat(new_path,&statbuf);
-    if ( S_ISDIR(statbuf.st_mode) && strcasecmp(last_path,new_path)!=0 )
+    /* Check if the new directory name doesn't already exists, and detect if it's
+     * only a case change (needs for vfat) */
+    if ( (dir=opendir(new_path))!=NULL )
     {
         gchar *msg;
         GtkWidget *msgbox;
 
-        msg = g_strdup_printf(_("Can't rename because this directory name "
-                                "already exists!\n(%s)"),new_path); 
-        msgbox = msg_box_new(_("Error..."),msg,MSG_ERROR,BUTTON_OK,0);
-        g_free(msg);
-        msg_box_hide_check_button(MSG_BOX(msgbox));
-        msg_box_run(MSG_BOX(msgbox));
-        gtk_widget_destroy(msgbox);
+        closedir(dir);
+        if ( strcasecmp(last_path,new_path)!=0 )
+        {
+            msg = g_strdup_printf(_("Can't rename because this directory name "
+                                    "already exists!\n(%s)"),new_path); 
+            msgbox = msg_box_new(_("Error..."),msg,MSG_ERROR,BUTTON_OK,0);
+            g_free(msg);
+            msg_box_hide_check_button(MSG_BOX(msgbox));
+            msg_box_run(MSG_BOX(msgbox));
+            gtk_widget_destroy(msgbox);
 
-        return;
+            return;
+        }
     }
 
     /* Temporary path (useful when changing only string case) */
diff -ruN easytag-0.24/src/easytag.c easytag-0.24b/src/easytag.c
--- easytag-0.24/src/easytag.c	Fri Sep 13 23:41:08 2002
+++ easytag-0.24b/src/easytag.c	Sun Oct  6 12:13:53 2002
@@ -1187,30 +1187,35 @@
 }
 void Rename_File (void)
 {
+    FILE  *file;
     gchar *tmp_filename = NULL;
     gchar *tmp_filename_string = NULL;
-    struct stat statbuf;
     gchar *cur_filename = ((File_Name *)((ET_File *)ETFileList->data)->FileNameCur->data)->value;
     gchar *new_filename = ((File_Name *)((ET_File *)ETFileList->data)->FileNameNew->data)->value;
 
     Statusbar_Message(_("Renaming file(s)..."),TRUE);
-    /* Check if a file already exists with the new name, and detect if it's only a case change (needs for vfat) */
-    stat(new_filename,&statbuf);
-    if ( S_ISREG(statbuf.st_mode) && strcasecmp(cur_filename,new_filename)!=0 )
+
+    /* Check if a file already exists with the new name, and detect if it's
+     * only a case change (needs for vfat) */
+    if ( (file=fopen(new_filename,"r"))!=NULL )
     {
         gchar *msg;
         GtkWidget *msgbox;
 
-        msg = g_strdup_printf(_("Can't rename file \n'%s'\nbecause the following "
-                    "file already exists:\n'%s'"),g_basename(cur_filename),g_basename(new_filename)); 
-        msgbox = msg_box_new (_("Error..."),msg,MSG_ERROR,BUTTON_OK,0);
-        g_free(msg);
-        msg_box_hide_check_button(MSG_BOX(msgbox));
-        msg_box_run(MSG_BOX(msgbox));
-        gtk_widget_destroy(msgbox);
+        fclose(file);
+        if ( strcasecmp(cur_filename,new_filename)!=0 )
+        {
+            msg = g_strdup_printf(_("Can't rename file \n'%s'\nbecause the following "
+                        "file already exists:\n'%s'"),g_basename(cur_filename),g_basename(new_filename)); 
+            msgbox = msg_box_new (_("Error..."),msg,MSG_ERROR,BUTTON_OK,0);
+            g_free(msg);
+            msg_box_hide_check_button(MSG_BOX(msgbox));
+            msg_box_run(MSG_BOX(msgbox));
+            gtk_widget_destroy(msgbox);
 
-        Statusbar_Message(_("File(s) not renamed..."),TRUE);
-        return;
+            Statusbar_Message(_("File(s) not renamed..."),TRUE);
+            return;
+        }
     }
 
     /* We use two stages to rename file, to avoid problem with some system


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