diff --git modules/lua/vlc.c modules/lua/vlc.c
index 14b5520..92668f1 100644
|
|
int vlclua_dir_list( const char *luadirname, char ***pppsz_dir_list ) |
234 | 234 | i++; |
235 | 235 | |
236 | 236 | #if defined(__APPLE__) |
237 | | if( likely(asprintf( &ppsz_dir_list[i], |
| 237 | if( strcasestr (psz_datapath, "/share") == NULL |
| 238 | && likely(asprintf( &ppsz_dir_list[i], |
238 | 239 | "%s"DIR_SEP"share"DIR_SEP"lua"DIR_SEP"%s", |
239 | 240 | psz_datapath, luadirname ) != -1) ) |
240 | 241 | i++; |
| 242 | // When installed through MacPorts (or Fink, or HomeBrew, or...?) we do have |
| 243 | // meta/reader under LibDir/lua (/opt/local/lib/vlc/lua for MacPorts's standard install prefix) |
| 244 | // so we add that location at the end. |
| 245 | char *psz_libpath = config_GetLibDir(); |
| 246 | if( likely(psz_libpath != NULL) ) |
| 247 | { |
| 248 | if( likely(asprintf( &ppsz_dir_list[i], "%s"DIR_SEP"lua"DIR_SEP"%s", |
| 249 | psz_libpath, luadirname ) != -1) ) |
| 250 | i++; |
| 251 | free( psz_libpath ); |
| 252 | } |
241 | 253 | #endif |
242 | 254 | free( psz_datapath ); |
243 | 255 | } |
diff --git src/darwin/dirs.c src/darwin/dirs.c
index 83c27a4..7e8b0cb 100644
|
|
|
42 | 42 | # define MAXPATHLEN 1024 |
43 | 43 | #endif |
44 | 44 | |
| 45 | // this is set to true in config_GetLibDir() if it detects we're installed |
| 46 | // in a (linux-specific) posix way. |
| 47 | static int libDirIsPosix = FALSE; |
| 48 | |
| 49 | // 20150205: we should do case-insensitive filename comparisons. HFS is case-insensitive by default, |
| 50 | // and while it strives to preserve case there is no guarantee that case folding will never occur, |
| 51 | // especially in directory components. |
| 52 | |
45 | 53 | static char *config_GetLibPath (void) |
46 | 54 | { |
47 | 55 | /* Get the full program path and name */ |
… |
… |
static char *config_GetLibPath (void) |
49 | 57 | for (unsigned i = 0; i < _dyld_image_count(); i++) |
50 | 58 | { |
51 | 59 | const char *psz_img_name = _dyld_get_image_name(i); |
52 | | const char *p = strstr( psz_img_name, "VLCKit.framework/Versions/" ); |
| 60 | const char *p = strcasestr( psz_img_name, "VLCKit.framework/Versions/" ); |
53 | 61 | |
54 | 62 | /* Check for "VLCKit.framework/Versions/Current/VLCKit", |
55 | 63 | * as well as "VLCKit.framework/Versions/A/VLCKit" and |
… |
… |
static char *config_GetLibPath (void) |
61 | 69 | p += strcspn( p, "/" ); |
62 | 70 | |
63 | 71 | /* If the string ends with VLC then we've found a winner */ |
64 | | if ( !strcmp( p, "/VLCKit" ) ) |
| 72 | if ( !strcasecmp( p, "/VLCKit" ) ) |
65 | 73 | return strdup( psz_img_name ); |
66 | 74 | } |
67 | 75 | |
68 | | /* Do we end by "VLC"? If so we are the legacy VLC.app that doesn't |
| 76 | /* Do we end in "MacOS/VLC"? If so we are the legacy (?!) VLC.app that doesn't |
69 | 77 | * link to VLCKit. */ |
70 | 78 | size_t len = strlen(psz_img_name); |
71 | | if( len >= 3 && !strcmp( psz_img_name + len - 3, "VLC") ) |
| 79 | if( len >= 9 && !strcasecmp( psz_img_name + len - 9, "MacOS/VLC") ) |
72 | 80 | return strdup( psz_img_name ); |
73 | 81 | |
74 | | /* Do we end by "VLC-Plugin"? oh, we must be the NPAPI plugin */ |
75 | | if( len >= 10 && !strcmp( psz_img_name + len - 10, "VLC-Plugin") ) |
| 82 | /* Do we end in "VLC-Plugin"? oh, we must be the NPAPI plugin */ |
| 83 | if( len >= 10 && !strcasecmp( psz_img_name + len - 10, "VLC-Plugin") ) |
76 | 84 | return strdup( psz_img_name ); |
77 | 85 | } |
78 | 86 | |
79 | | /* We are not linked to the VLC.framework, let's use dladdr to figure |
80 | | * libvlc path */ |
| 87 | /* We are not linked to the VLC.framework, we'rebreak not VLC.app either, |
| 88 | * so let's use dladdr to figure the libvlc path */ |
81 | 89 | Dl_info info; |
82 | 90 | if( dladdr(system_Init, &info) ) |
83 | | return strdup(dirname( info.dli_fname )); |
| 91 | return strdup(dirname( (char*)info.dli_fname )); |
84 | 92 | |
85 | 93 | char path[MAXPATHLEN+1]; |
86 | 94 | uint32_t path_len = sizeof(path) - 1; |
… |
… |
char *config_GetLibDir (void) |
99 | 107 | if (p != NULL) |
100 | 108 | { |
101 | 109 | *p = '\0'; |
| 110 | p = strrchr (path, '.'); |
| 111 | if (p == NULL || !strcasestr(p, ".app/Contents/MacOS")) |
| 112 | { |
| 113 | // we're NOT running an OS X style app bundle; |
| 114 | // return the Linux/POSIX style LibDir. |
| 115 | free(path); |
| 116 | path = strdup (PKGLIBDIR); |
| 117 | libDirIsPosix = TRUE; |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | libDirIsPosix = FALSE; |
| 122 | } |
102 | 123 | return path; |
103 | 124 | } |
104 | 125 | free (path); |
… |
… |
char *config_GetDataDir (void) |
115 | 136 | return strdup (path); |
116 | 137 | |
117 | 138 | char *vlcpath = config_GetLibDir (); |
118 | | char *datadir; |
| 139 | char *datadir = NULL; |
119 | 140 | |
| 141 | if (libDirIsPosix) |
| 142 | { |
| 143 | // vlcpath should point to something like /opt/local/lib/vlc |
| 144 | // if so, we can chop off the /lib/vlc bit, and then add /share |
| 145 | // like we would otherwise. |
| 146 | char *p = strcasestr (vlcpath, "/lib/"); |
| 147 | if (p != NULL) |
| 148 | { |
| 149 | *p = '\0'; |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | // something else ... return PKGDATADIR |
| 154 | free(vlcpath); |
| 155 | datadir = strdup(PKGDATADIR); |
| 156 | return datadir; |
| 157 | } |
| 158 | } |
120 | 159 | if (asprintf (&datadir, "%s/share", vlcpath) == -1) |
121 | 160 | datadir = NULL; |
122 | 161 | |
diff --git src/interface/interface.c src/interface/interface.c
index b1dcfaf..f31a4a5 100644
|
|
int intf_Create( vlc_object_t *p_this, const char *chain ) |
113 | 113 | char *module; |
114 | 114 | char *psz_tmp = config_ChainCreate( &module, &p_intf->p_cfg, |
115 | 115 | psz_parser ); |
116 | | free( psz_tmp ); |
117 | | free( psz_parser ); |
| 116 | if (psz_tmp) |
| 117 | { |
| 118 | free( psz_tmp ); |
| 119 | } |
| 120 | if (psz_parser) |
| 121 | { |
| 122 | free( psz_parser ); |
| 123 | } |
118 | 124 | p_intf->p_module = module_need( p_intf, "interface", module, true ); |
119 | 125 | free(module); |
120 | 126 | if( p_intf->p_module == NULL ) |