Commit b25b7890 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

dirs_macos: When running from command line there is no bundle identifier by default.

parent 81dc52be
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment