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) ...@@ -90,13 +90,25 @@ static char *getAppDependentDir(vlc_userdir_t type)
break; break;
} }
// Default fallback
const char *name = "org.videolan.vlc";
CFBundleRef mainBundle = CFBundleGetMainBundle(); CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle)
{
CFStringRef identifierAsNS = CFBundleGetIdentifier(mainBundle); CFStringRef identifierAsNS = CFBundleGetIdentifier(mainBundle);
const char *identifier = CFStringGetCStringPtr(identifierAsNS, kCFStringEncodingUTF8); if (identifierAsNS)
{
char identifier[256];
Boolean ret = CFStringGetCString(identifierAsNS, identifier, sizeof(identifier), kCFStringEncodingUTF8);
if (ret)
name = identifier;
}
}
char *psz_parent = config_GetHomeDir (); char *psz_parent = config_GetHomeDir ();
char *psz_dir; 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; psz_dir = NULL;
free(psz_parent); 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