Changeset 7693 for trunk/gtk/util.c


Ignore:
Timestamp:
Jan 13, 2009, 1:44:59 AM (12 years ago)
Author:
charles
Message:

(trunk gtk) #1690: Torrent is completed without ever starting (because there's nothing to download)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/util.c

    r7473 r7693  
    2424
    2525#include <ctype.h> /* isxdigit() */
     26#include <errno.h>
    2627#include <stdarg.h>
    2728#include <stdlib.h> /* free() */
     
    522523        gboolean trashed = FALSE;
    523524#ifdef HAVE_GIO
     525        GError * err = NULL;
    524526        GFile *  file = g_file_new_for_path( filename );
    525         trashed = g_file_trash( file, NULL, NULL );
     527        trashed = g_file_trash( file, NULL, &err );
     528        if( err )
     529            g_message( "Unable to trash file \"%s\": %s", filename, err->message );
     530        g_clear_error( &err );
    526531        g_object_unref( G_OBJECT( file ) );
    527 #endif
    528         if( !trashed )
    529             g_unlink( filename );
     532       
     533       
     534#endif
     535        if( !trashed ) {
     536            if( g_unlink( filename ) ) {
     537                const int err = errno;
     538                g_message( "Unable to unlink file \"%s\": %s", filename, g_strerror( err ) );
     539            }
     540        }
    530541    }
    531542
Note: See TracChangeset for help on using the changeset viewer.