mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk gtk) make check_filenames() a private function
This commit is contained in:
parent
2ff810d18f
commit
1457567880
3 changed files with 33 additions and 36 deletions
33
gtk/main.c
33
gtk/main.c
|
@ -442,6 +442,39 @@ onRPCChanged( tr_session * session UNUSED,
|
||||||
return TR_RPC_OK;
|
return TR_RPC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GSList *
|
||||||
|
checkfilenames( int argc, char **argv )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
GSList * ret = NULL;
|
||||||
|
char * pwd = g_get_current_dir( );
|
||||||
|
|
||||||
|
for( i=0; i<argc; ++i )
|
||||||
|
{
|
||||||
|
if( gtr_is_supported_url( argv[i] ) || gtr_is_magnet_link( argv[i] ) )
|
||||||
|
{
|
||||||
|
ret = g_slist_prepend( ret, g_strdup( argv[i] ) );
|
||||||
|
}
|
||||||
|
else /* local file */
|
||||||
|
{
|
||||||
|
char * filename = g_path_is_absolute( argv[i] )
|
||||||
|
? g_strdup ( argv[i] )
|
||||||
|
: g_build_filename( pwd, argv[i], NULL );
|
||||||
|
|
||||||
|
if( g_file_test( filename, G_FILE_TEST_EXISTS ) )
|
||||||
|
ret = g_slist_prepend( ret, filename );
|
||||||
|
else {
|
||||||
|
if( gtr_is_hex_hashcode( argv[i] ) )
|
||||||
|
ret = g_slist_prepend( ret, g_strdup_printf( "magnet:?xt=urn:btih:%s", argv[i] ) );
|
||||||
|
g_free( filename );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free( pwd );
|
||||||
|
return g_slist_reverse( ret );
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main( int argc, char ** argv )
|
main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
|
|
33
gtk/util.c
33
gtk/util.c
|
@ -352,39 +352,6 @@ gtr_is_hex_hashcode( const char * str )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList *
|
|
||||||
checkfilenames( int argc, char **argv )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
GSList * ret = NULL;
|
|
||||||
char * pwd = g_get_current_dir( );
|
|
||||||
|
|
||||||
for( i=0; i<argc; ++i )
|
|
||||||
{
|
|
||||||
if( gtr_is_supported_url( argv[i] ) || gtr_is_magnet_link( argv[i] ) )
|
|
||||||
{
|
|
||||||
ret = g_slist_prepend( ret, g_strdup( argv[i] ) );
|
|
||||||
}
|
|
||||||
else /* local file */
|
|
||||||
{
|
|
||||||
char * filename = g_path_is_absolute( argv[i] )
|
|
||||||
? g_strdup ( argv[i] )
|
|
||||||
: g_build_filename( pwd, argv[i], NULL );
|
|
||||||
|
|
||||||
if( g_file_test( filename, G_FILE_TEST_EXISTS ) )
|
|
||||||
ret = g_slist_prepend( ret, filename );
|
|
||||||
else {
|
|
||||||
if( gtr_is_hex_hashcode( argv[i] ) )
|
|
||||||
ret = g_slist_prepend( ret, g_strdup_printf( "magnet:?xt=urn:btih:%s", argv[i] ) );
|
|
||||||
g_free( filename );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free( pwd );
|
|
||||||
return g_slist_reverse( ret );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
addTorrentErrorDialog( GtkWidget * child,
|
addTorrentErrorDialog( GtkWidget * child,
|
||||||
int err,
|
int err,
|
||||||
|
|
|
@ -62,9 +62,6 @@ void freestrlist( GSList *list );
|
||||||
/* decodes a string that has been urlencoded */
|
/* decodes a string that has been urlencoded */
|
||||||
char * decode_uri( const char * uri );
|
char * decode_uri( const char * uri );
|
||||||
|
|
||||||
/* return a list of cleaned-up paths, with invalid directories removed */
|
|
||||||
GSList * checkfilenames( int argc, char ** argv );
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
****
|
****
|
||||||
***/
|
***/
|
||||||
|
|
Loading…
Reference in a new issue