Changeset 6924 for trunk/libtransmission/platform.c
- Timestamp:
- Oct 19, 2008, 5:43:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/platform.c
r6902 r6924 466 466 "Application Support", "Transmission", NULL ); 467 467 #elif defined( WIN32 ) 468 char appdata[MAX_PATH_LENGTH];469 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata);470 s = tr_buildPath( appdata, "Transmission", NULL );468 char configDir[MAX_PATH_LENGTH]; 469 GetModuleFileName( GetModuleHandle( NULL ), configDir, sizeof( configDir ) ); 470 s = tr_buildPath( basename( configDir ), "Transmission", NULL ); 471 471 #else 472 472 if( ( s = getenv( "XDG_CONFIG_HOME" ) ) ) … … 514 514 else 515 515 { 516 516 517 #ifdef SYS_DARWIN 517 CFURLRef appURL = CFBundleCopyBundleURL( 518 519 CFStringRef appRef = CFURLCopyFileSystemPath(520 appURL,kCFURLPOSIXPathStyle );521 const char * appString = CFStringGetCStringPtr( 522 appRef,CFStringGetFastestEncoding( appRef ) );518 519 CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) ); 520 CFStringRef appRef = CFURLCopyFileSystemPath( appURL, 521 kCFURLPOSIXPathStyle ); 522 const char * appString = CFStringGetCStringPtr( appRef, 523 CFStringGetFastestEncoding( appRef ) ); 523 524 CFRelease( appURL ); 524 525 CFRelease( appRef ); 525 526 526 527 s = tr_buildPath( appString, "Contents", "Resources", "web", NULL ); 527 #elif defined( WIN32 ) 528 529 #warning hey win32 people is this good or is there a better implementation of the next four lines 530 char appdata[MAX_PATH_LENGTH]; 531 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata ); 532 s = tr_buildPath( appdata, "Transmission", NULL ); 533 #else 528 529 #elif defined( WIN32 ) 530 531 /* SHGetFolderPath explicitly requires MAX_PATH length */ 532 char dir[MAX_PATH]; 533 534 /* Generally, Web interface should be stored in a Web subdir of 535 * calling executable dir. */ 536 537 if( s == NULL ) { 538 /* First, we should check personal AppData/Transmission/Web */ 539 SHGetFolderPath( NULL, CSIDL_COMMON_APPDATA, NULL, 0, dir ); 540 s = tr_buildPath( dir, "Transmission", "Web", NULL ); 541 if( !isClutchDir( s ) ) { 542 tr_free( s ); 543 s = NULL; 544 } 545 } 546 547 if( s == NULL ) { 548 /* check personal AppData */ 549 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, dir ); 550 s = tr_buildPath( dir, "Transmission", "Web", NULL ); 551 if( !isClutchDir( s ) ) { 552 tr_free( s ); 553 s = NULL; 554 } 555 } 556 557 if( s == NULL) { 558 /* check calling module place */ 559 GetModuleFileName( GetModuleHandle( NULL ), dir, sizeof( dir ) ); 560 s = tr_buildPath( dirname( dir ), "Web", NULL ); 561 if( !isClutchDir( s ) ) { 562 tr_free( s ); 563 s = NULL; 564 } 565 } 566 567 #else /* everyone else, follow the XDG spec */ 568 534 569 tr_list *candidates = NULL, *l; 535 570 … … 574 609 575 610 tr_list_free( &candidates, tr_free ); 576 #endif 611 612 #endif 613 577 614 } 578 615 }
Note: See TracChangeset
for help on using the changeset viewer.