From: Pierre d'Herbemont Date: Wed, 6 Jan 2010 15:02:15 +0000 (+0100) Subject: dirs_macos: When running from command line there is no bundle identifier by default. X-Git-Tag: 1.1.0-ff~1409 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b25b7890e2c5166fa19c6ebbd43369ddc6d89547;p=vlc dirs_macos: When running from command line there is no bundle identifier by default. --- diff --git a/src/config/dirs_macos.c b/src/config/dirs_macos.c index fc91de2e1c..7c00f022b5 100644 --- a/src/config/dirs_macos.c +++ b/src/config/dirs_macos.c @@ -90,13 +90,25 @@ static char *getAppDependentDir(vlc_userdir_t type) break; } + // Default fallback + const char *name = "org.videolan.vlc"; + CFBundleRef mainBundle = CFBundleGetMainBundle(); - CFStringRef identifierAsNS = CFBundleGetIdentifier(mainBundle); - const char *identifier = CFStringGetCStringPtr(identifierAsNS, kCFStringEncodingUTF8); - + if (mainBundle) + { + CFStringRef identifierAsNS = CFBundleGetIdentifier(mainBundle); + if (identifierAsNS) + { + char identifier[256]; + Boolean ret = CFStringGetCString(identifierAsNS, identifier, sizeof(identifier), kCFStringEncodingUTF8); + if (ret) + name = identifier; + } + } + char *psz_parent = config_GetHomeDir (); char *psz_dir; - if( asprintf( &psz_dir, psz_path, psz_parent, identifier) == -1 ) + if( asprintf( &psz_dir, psz_path, psz_parent, name) == -1 ) psz_dir = NULL; free(psz_parent);