Changeset 6319


Ignore:
Timestamp:
Jul 11, 2008, 4:07:14 AM (13 years ago)
Author:
charles
Message:

(1) add clutch to the tarball.
(2) on autoconf-based installs, install the clutch files in $(datadir)/transmission/web
(3) new function tr_getClutchDir(). Default implementation follows the XDG spec.

Location:
trunk
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.am

    r6286 r6319  
    3232
    3333EXTRA_DIST = \
     34  web \
    3435  NEWS \
    3536  AUTHORS \
     
    3940  intltool-extract.in \
    4041  intltool-merge.in \
    41   intltool-update.in
     42  intltool-update.in
     43
     44clutchdir = $(datadir)/transmission/web
     45clutch_DATA = \
     46  web/index.html \
     47  web/LICENSE
     48
     49clutch_cssdir = $(clutchdir)/stylesheets
     50clutch_css_DATA = \
     51  web/stylesheets/iphone.css \
     52  web/stylesheets/common.css
     53
     54clutch_jsdir = $(clutchdir)/javascript
     55clutch_js_DATA = \
     56  web/javascript/menu.js \
     57  web/javascript/dialog.js \
     58  web/javascript/transmission.js \
     59  web/javascript/transmission.remote.js \
     60  web/javascript/common.js \
     61  web/javascript/torrent.js
     62
     63clutch_jquerydir = $(clutch_jsdir)/jquery
     64clutch_jquery_DATA = \
     65  web/javascript/jquery \
     66  web/javascript/jquery/json.min.js \
     67  web/javascript/jquery/jquery.contextmenu.min.js \
     68  web/javascript/jquery/jquery.min.js \
     69  web/javascript/jquery/jquery.form.min.js \
     70  web/javascript/jquery/jquery.transmenu.min.js \
     71  web/javascript/jquery/jquery-dimensions.min.js
     72
     73clutch_imagesdir = $(clutchdir)/images
     74clutch_images_DATA = \
     75  web/images/favicon.ico \
     76  web/images/webclip-icon.png
     77
     78clutch_graphicsdir = $(clutch_imagesdir)/graphics
     79clutch_graphics_DATA = \
     80  web/images/graphics/browser_firefox.gif \
     81  web/images/graphics/logo.png \
     82  web/images/graphics/chrome.png \
     83  web/images/graphics/iphone_chrome.png \
     84  web/images/graphics/browser_opera.gif \
     85  web/images/graphics/filter_bar.png \
     86  web/images/graphics/transfer_arrows.png \
     87  web/images/graphics/browser_safari.gif
     88
     89clutch_progressdir = $(clutch_imagesdir)/progress
     90clutch_progress_DATA = \
     91  web/images/progress/progress.png
     92
     93clutch_buttonsdir = $(clutch_imagesdir)/buttons
     94clutch_buttons_DATA = \
     95  web/images/buttons/tab_backgrounds.png \
     96  web/images/buttons/toolbar_buttons.png \
     97  web/images/buttons/info_general.png \
     98  web/images/buttons/torrent_buttons.png \
     99  web/images/buttons/info_activity.png
    42100
    43101DISTCLEANFILES = \
     
    45103  intltool-merge \
    46104  intltool-update
    47 
  • trunk/libtransmission/platform.c

    r5843 r6319  
    5151
    5252#include "transmission.h"
     53#include "list.h"
    5354#include "platform.h"
    5455#include "utils.h"
     
    509510***/
    510511
     512static int
     513isClutchDir( const char * path )
     514{
     515    struct stat sb;
     516    char tmp[MAX_PATH_LENGTH];
     517    tr_buildPath( tmp, sizeof( tmp ), path, "javascript", "transmission.js", NULL );
     518fprintf( stderr, "path is [%s]; testing [%s] for clutch\n", path, tmp );
     519    return !stat( tmp, &sb );
     520}
     521
     522const char *
     523tr_getClutchDir( const tr_session * session UNUSED )
     524{
     525    static char * s = NULL;
     526
     527    if( !s )
     528    {
     529        char path[MAX_PATH_LENGTH];
     530
     531        if(( s = getenv( "CLUTCH_HOME" )))
     532        {
     533            snprintf( path, sizeof( path ), s );
     534        }
     535        else
     536        {
     537#ifdef SYS_DARWIN
     538#error not implemented
     539#elif defined(WIN32)
     540#warning hey win32 people is this good or is there a better implementation of the next four lines
     541            char appdata[MAX_PATH_LENGTH];
     542            SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
     543            tr_buildPath( path, sizeof( path ),
     544                          appdata, "Transmission", NULL );
     545#else
     546            tr_list *candidates=NULL, *l;
     547
     548            /* XDG_DATA_HOME should be the first in the list of candidates */
     549            s = getenv( "XDG_DATA_HOME" );
     550            if( s && *s )
     551                tr_list_append( &candidates, tr_strdup( s ) );
     552            else {
     553                char tmp[MAX_PATH_LENGTH];
     554                tr_buildPath( tmp, sizeof( tmp ), getHomeDir(), ".local", "share", NULL );
     555                tr_list_append( &candidates, tr_strdup( tmp ) );
     556            }
     557
     558            /* XDG_DATA_DIRS are the backup directories */
     559            s = getenv( "XDG_DATA_DIRS" );
     560            if( !s || !*s )
     561                s = "/usr/local/share/:/usr/share/";
     562            while( s && *s ) {
     563                char * end = strchr( s, ':' );
     564                if( end ) {
     565                    tr_list_append( &candidates, tr_strndup( s, end-s ) );
     566                    s = end + 1;
     567                } else {
     568                    tr_list_append( &candidates, tr_strdup( s ) );
     569                    break;
     570                }
     571            }
     572
     573            for( l=candidates; l; l=l->next ) {
     574                tr_buildPath( path, sizeof( path ), l->data, "transmission", "clutch", NULL );
     575                if( isClutchDir( path ) )
     576                    break;
     577                *path = '\0';
     578            }
     579
     580            tr_list_free( &candidates, tr_free );
     581#endif
     582        }
     583
     584        if( !*path )
     585        {
     586            tr_err( _( "Unable to find web interface files" ) );
     587            tr_strlcpy( path, "/dev/null", sizeof( path ) );
     588        }
     589
     590        s = tr_strdup( path );
     591    }
     592
     593    return s;
     594}
     595
     596
     597/***
     598****
     599***/
     600
    511601int
    512602tr_lockfile( const char * filename )
  • trunk/libtransmission/platform.h

    r5645 r6319  
    4545const char * tr_getTorrentDir ( const struct tr_handle * );
    4646
     47const char * tr_getClutchDir  ( const struct tr_handle * );
     48
     49
    4750tr_thread*   tr_threadNew  ( void (*func)(void *), void * arg, const char * name );
    4851int          tr_amInThread ( const tr_thread * );
  • trunk/libtransmission/rpc-server.c

    r6275 r6319  
    2525#include "transmission.h"
    2626#include "bencode.h"
     27#include "platform.h"
    2728#include "rpc.h"
    2829#include "rpc-server.h"
     
    252253        char ports[128];
    253254        char passwd[MAX_PATH_LENGTH];
    254         char clutchDir[MAX_PATH_LENGTH];
    255         char * clutchAlias;
     255        const char * clutchDir = tr_getClutchDir( server->session );
     256        char * clutchAlias = tr_strdup_printf( "%s=%s", "/transmission/clutch", clutchDir );
    256257        struct timeval tv = tr_timevalMsec( UNUSED_INTERVAL_MSEC );
    257258
    258         tr_buildPath( clutchDir, sizeof( clutchDir ), tr_sessionGetConfigDir( server->session ), "clutch", NULL );
    259         clutchAlias = tr_strdup_printf( "%s=%s", "/transmission/clutch", clutchDir );
    260 
     259fprintf( stderr, "clutchAlias is [%s]\n", clutchAlias );
    261260        getPasswordFile( server, passwd, sizeof( passwd ) );
    262261        if( !server->isPasswordEnabled )
Note: See TracChangeset for help on using the changeset viewer.