Changeset 9919


Ignore:
Timestamp:
Jan 12, 2010, 4:43:37 PM (12 years ago)
Author:
charles
Message:

(trunk) add a log message telling the user which configDir is being used and whether or not its settings.json was used

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r9868 r9919  
    279279    tr_benc settings;
    280280    tr_bool boolVal;
     281    tr_bool loaded;
    281282    tr_bool foreground = FALSE;
    282283    tr_bool dumpSettings = FALSE;
     
    293294    tr_bencInitDict( &settings, 0 );
    294295    configDir = getConfigDir( argc, (const char**)argv );
    295     tr_sessionLoadSettings( &settings, configDir, MY_NAME );
     296    loaded = tr_sessionLoadSettings( &settings, configDir, MY_NAME );
    296297    tr_bencDictAddBool( &settings, TR_PREFS_KEY_RPC_ENABLED, TRUE );
    297298
     
    381382    /* start the session */
    382383    mySession = tr_sessionInit( "daemon", configDir, TRUE, &settings );
     384
     385    if( loaded )
     386        tr_ninf( NULL, "Using settings from \"%s\"", configDir );
     387    else
     388        tr_nerr( NULL, "Couldn't find settings in \"%s\"; using defaults", configDir );
     389
    383390    tr_sessionSaveSettings( mySession, configDir, &settings );
    384391
  • trunk/libtransmission/session.c

    r9915 r9919  
    393393}
    394394
    395 void
     395tr_bool
    396396tr_sessionLoadSettings( tr_benc * d, const char * configDir, const char * appName )
    397397{
     
    400400    tr_benc sessionDefaults;
    401401    tr_benc tmp;
     402    tr_bool success = FALSE;
    402403
    403404    assert( tr_bencIsDict( d ) );
     
    419420        tr_bencMergeDicts( d, &fileSettings );
    420421        tr_bencFree( &fileSettings );
     422        success = TRUE;
    421423    }
    422424
     
    424426    tr_bencFree( &sessionDefaults );
    425427    tr_free( filename );
     428    return success;
    426429}
    427430
  • trunk/libtransmission/transmission.h

    r9902 r9919  
    250250 * @param configDir the configuration directory to find settings.json
    251251 * @param appName if configDir is empty, appName is used to find the default dir.
     252 * @return success TRUE if the settings were loaded, FALSE otherwise
    252253 * @see tr_sessionGetDefaultSettings()
    253254 * @see tr_sessionInit()
    254255 * @see tr_sessionSaveSettings()
    255256 */
    256 void tr_sessionLoadSettings( struct tr_benc  * dictionary,
    257                              const char      * configDir,
    258                              const char      * appName );
     257tr_bool tr_sessionLoadSettings( struct tr_benc  * dictionary,
     258                                const char      * configDir,
     259                                const char      * appName );
    259260
    260261/**
Note: See TracChangeset for help on using the changeset viewer.