Changeset 14491 for trunk/libtransmission/session.c
- Timestamp:
- Apr 11, 2015, 10:51:59 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/session.c
r14479 r14491 33 33 #include "cache.h" 34 34 #include "crypto-utils.h" 35 #include "error.h" 36 #include "error-types.h" 35 37 #include "fdlimit.h" 36 38 #include "file.h" … … 457 459 tr_sessionLoadSettings (tr_variant * dict, const char * configDir, const char * appName) 458 460 { 459 int err = 0;460 461 char * filename; 461 462 tr_variant fileSettings; 462 463 tr_variant sessionDefaults; 463 464 tr_variant tmp; 464 bool success = false; 465 bool success; 466 tr_error * error = NULL; 465 467 466 468 assert (tr_variantIsDict (dict)); … … 481 483 /* file settings override the defaults */ 482 484 filename = tr_buildPath (configDir, "settings.json", NULL); 483 err = tr_variantFromFile (&fileSettings, TR_VARIANT_FMT_JSON, filename); 484 if (!err) 485 if (tr_variantFromFile (&fileSettings, TR_VARIANT_FMT_JSON, filename, &error)) 485 486 { 486 487 tr_variantMergeDicts (dict, &fileSettings); 487 488 tr_variantFree (&fileSettings); 489 success = true; 490 } 491 else 492 { 493 success = TR_ERROR_IS_ENOENT (error->code); 494 tr_error_free (error); 488 495 } 489 496 … … 491 498 tr_variantFree (&sessionDefaults); 492 499 tr_free (filename); 493 success = (err==0) || (err==ENOENT);494 500 return success; 495 501 } … … 510 516 { 511 517 tr_variant fileSettings; 512 const int err = tr_variantFromFile (&fileSettings, TR_VARIANT_FMT_JSON, filename); 513 if (!err) 518 if (tr_variantFromFile (&fileSettings, TR_VARIANT_FMT_JSON, filename, NULL)) 514 519 { 515 520 tr_variantMergeDicts (&settings, &fileSettings);
Note: See TracChangeset
for help on using the changeset viewer.