xffm changes

edscott wilson garcia edscott at imp.mx
Mon Jan 27 13:54:44 CET 2003


El lun, 27-01-2003 a las 01:07, Jens Luedicke escribió:
> On Mon, 2003-01-27 at 04:35, edscott wilson garcia wrote:
> 
> > If you want to put in the glib code again, it's fine with me, but
> > *please* don't cut out the rename where the new_name() function is
> > called. new_name() creates a version controlled name for the backup
> > file.
> > 
> 
> I attached a patch of my new old changes. They include the backup
> feature. I tested them and they work for me.

If you use xfdiff to create your patch files (or create them in unified
format), I could actually use xfdiff to see what changes are implied,
line by line. The way you are sending them makes it more difficult to
read and I need more time to do so

Edscott 

> 
> Jens 
> 
> 
> ----
> 

> Index: remove.c
> ===================================================================
> RCS file: /cvsroot/xfce/xfce-devel/xffm/src/remove.c,v
> retrieving revision 1.14
> diff -r1.14 remove.c
> 147,172c147,199
> < gboolean wasteit(char *path){
> < 	char *directory=g_strdup(path);
> < 	char wastepath[256];
> < 	char wastename[256];
> < 	if (!strchr(path,'/')) g_assert_not_reached();
> < 	if (strlen(path)==1) return FALSE;
> < 	*(strrchr(directory,'/'))=0;
> < 	sprintf(wastepath,"%s/..Wastebasket",directory);
> < 	g_free(directory);
> < 	/*printf("DBG:wastepath=%s\n",wastepath);*/
> < 	if (access(wastepath,F_OK) != 0){
> < 		if (mkdir (wastepath, 0xFFFF) < 0) return FALSE;
> < 		
> < 	}
> < 	sprintf(wastename,"%s/%s",wastepath,strrchr(path,'/')+1);
> < 	/*printf("DBG:wastename=%s path=%s\n",wastename,path);*/
> < 	if (access(wastename,F_OK) == 0) {
> < 	   /* too harsh: if (!unlinkit(wastename)) return FALSE;*/
> < 	   char wastebackup[256];
> < 	   sprintf(wastebackup,"%s/%s",
> < 		wastepath,new_name(wastepath,strrchr(wastename,'/')+1));
> < 	   /*printf("DBG:wastebackup=%s\n",wastebackup);*/
> < 	   if (rename(wastename,wastebackup)<0) return FALSE;
> < 	}
> < 	if (rename(path,wastename)<0) return FALSE;
> < 	return TRUE;
> ---
> > gboolean
> > wasteit (char *path)
> > {
> >   gchar *filepath = NULL;
> >   gchar *filename = NULL;
> >   gchar *wastepath = NULL;
> >   gchar *wastename = NULL;
> >   gchar *wastebackup = NULL;
> > 
> >   if (!strchr (path, '/'))
> >     g_assert_not_reached ();
> > 
> >   if (strlen (path) == 1)
> >     return FALSE;
> > 
> >   filepath = g_path_get_dirname (path);
> >   filename = g_path_get_basename (path);
> > 
> >   wastepath = g_strconcat (filepath, "/..Wastebasket/", NULL);
> >   wastename = g_strconcat (wastepath, filename, NULL);
> > 
> >   /*
> >      printf("DBG:wastepath=%s\n",wastepath);
> >      printf("DBG:wastename=%s path=%s\n",wastename,path);
> >    */
> > 
> >   if (access (wastepath, F_OK) != 0)
> >     {
> >       if (mkdir (wastepath, 0xFFFF) < 0)
> > 	return FALSE;
> >     }
> > 
> >   if (access(wastename,F_OK) == 0) {
> > 	/* too harsh: if (!unlinkit(wastename)) return FALSE;*/
> > 	wastebackup = g_strconcat(wastepath, new_name(wastepath, filename));
> > 	/*
> > 	printf("DBG:wastebackup=%s\n",wastebackup);
> > 	*/
> > 
> > 	if (rename(wastename,wastebackup)<0)
> > 	    return FALSE;
> >   }
> > 
> >   if (rename (path, wastename) < 0)
> >     return FALSE;
> > 
> >   g_free (filepath);
> >   g_free (filename);
> >   g_free (wastepath);
> >   g_free (wastename);
> >   g_free (wastebackup);
> > 
> >   return TRUE;





More information about the Xfce4-dev mailing list