mirror of
https://github.com/transmission/transmission
synced 2025-02-02 20:43:51 +00:00
#3072 Make Transmission look for the web ui folder in the Application Support folder first
This commit is contained in:
parent
0cbdd6c48c
commit
d1229a263c
1 changed files with 23 additions and 12 deletions
|
@ -544,27 +544,38 @@ tr_getWebClientDir( const tr_session * session UNUSED )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef SYS_DARWIN /* on Mac, look in the app package first, then the Application Support folder (for daemon, etc) */
|
#ifdef SYS_DARWIN /* on Mac, look in the Application Support folder first, then in the app bundle. */
|
||||||
|
|
||||||
CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) );
|
/* Look in the Application Support folder */
|
||||||
CFStringRef appRef = CFURLCopyFileSystemPath( appURL,
|
s = tr_buildPath( tr_sessionGetConfigDir( session ), "web", NULL );
|
||||||
kCFURLPOSIXPathStyle );
|
|
||||||
const char * appString = CFStringGetCStringPtr( appRef,
|
|
||||||
CFStringGetFastestEncoding( appRef ) );
|
|
||||||
CFRelease( appURL );
|
|
||||||
CFRelease( appRef );
|
|
||||||
|
|
||||||
s = tr_buildPath( appString, "Contents", "Resources", "web", NULL );
|
|
||||||
|
|
||||||
if( !isWebClientDir( s ) ) {
|
if( !isWebClientDir( s ) ) {
|
||||||
tr_free( s );
|
tr_free( s );
|
||||||
|
|
||||||
/* Fallback to the Application Support folder */
|
CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) );
|
||||||
s = tr_buildPath( tr_sessionGetConfigDir( session ), "web", NULL );
|
CFStringRef appRef = CFURLCopyFileSystemPath( appURL,
|
||||||
|
kCFURLPOSIXPathStyle );
|
||||||
|
CFIndex appLength = CFStringGetMaximumSizeForEncoding( CFStringGetLength(appRef),
|
||||||
|
CFStringGetFastestEncoding( appRef ));
|
||||||
|
|
||||||
|
char * appString = tr_malloc( appLength + 1 );
|
||||||
|
tr_bool success = CFStringGetCString( appRef,
|
||||||
|
appString,
|
||||||
|
appLength + 1,
|
||||||
|
CFStringGetFastestEncoding( appRef ));
|
||||||
|
assert( success );
|
||||||
|
|
||||||
|
CFRelease( appURL );
|
||||||
|
CFRelease( appRef );
|
||||||
|
|
||||||
|
/* Fallback to the app bundle */
|
||||||
|
s = tr_buildPath( appString, "Contents", "Resources", "web", NULL );
|
||||||
if( !isWebClientDir( s ) ) {
|
if( !isWebClientDir( s ) ) {
|
||||||
tr_free( s );
|
tr_free( s );
|
||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_free( appString );
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined( WIN32 )
|
#elif defined( WIN32 )
|
||||||
|
|
Loading…
Reference in a new issue