[vlc-commits] posix: add VLC_SYSDATA_DIR for datadir
Rémi Denis-Courmont
git at videolan.org
Tue Mar 6 20:17:32 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 5 23:10:08 2018 +0200| [f8c596db7a60628df7fc2da16254450095ed701f] | committer: Rémi Denis-Courmont
posix: add VLC_SYSDATA_DIR for datadir
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8c596db7a60628df7fc2da16254450095ed701f
---
include/vlc_configuration.h | 5 +++++
src/Makefile.am | 1 +
src/darwin/dirs.c | 4 +++-
src/os2/dirs.c | 4 +++-
src/posix/dirs.c | 2 ++
src/win32/dirs.c | 4 +++-
6 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index a4854126a3..1be4867f12 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -278,6 +278,11 @@ typedef enum vlc_system_dir
data directory (e.g. /usr/local/data/vlc). */
VLC_PKG_LIB_DIR, /**< Package-specific architecture-dependent read-only
data directory (e.g. /usr/local/lib/vlc). */
+ VLC_PKG_LIBEXEC_DIR_RESERVED,
+ VLC_PKG_INCLUDE_DIR_RESERVED,
+ VLC_SYSDATA_DIR, /**< Global architecture-independent read-only
+ data directory (e.g. /usr/local/data).
+ Available only on some platforms. */
} vlc_sysdir_t;
/**
diff --git a/src/Makefile.am b/src/Makefile.am
index 61c93df705..46b29d67d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -169,6 +169,7 @@ lib_LTLIBRARIES = libvlccore.la
AM_CPPFLAGS = $(INCICONV) $(IDN_CFLAGS) \
-DMODULE_STRING=\"core\" \
+ -DSYSDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DPKGDATADIR=\"$(pkgdatadir)\" \
diff --git a/src/darwin/dirs.c b/src/darwin/dirs.c
index 8b427163f7..afe406a87a 100644
--- a/src/darwin/dirs.c
+++ b/src/darwin/dirs.c
@@ -110,7 +110,7 @@ static char *config_GetDataDir(void)
char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
{
- char *dir;
+ char *dir = NULL;
switch (type)
{
@@ -120,6 +120,8 @@ char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
case VLC_PKG_LIB_DIR:
dir = config_GetLibDir();
break;
+ case VLC_SYSDATA_DIR:
+ break;
default:
vlc_assert_unreachable();
}
diff --git a/src/os2/dirs.c b/src/os2/dirs.c
index 552cc2fcd5..e649731a1d 100644
--- a/src/os2/dirs.c
+++ b/src/os2/dirs.c
@@ -66,7 +66,7 @@ static char *config_GetDataDir(void)
char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
{
- char *dir;
+ char *dir = NULL;
switch (type)
{
@@ -76,6 +76,8 @@ char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
case VLC_PKG_LIB_DIR:
dir = config_GetLibDir();
break;
+ case VLC_SYSDATA_DIR:
+ break;
default:
vlc_assert_unreachable();
}
diff --git a/src/posix/dirs.c b/src/posix/dirs.c
index ee1c94cb27..69ce7a07d2 100644
--- a/src/posix/dirs.c
+++ b/src/posix/dirs.c
@@ -68,10 +68,12 @@ char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
static const char *const dirs[] = {
[VLC_PKG_LIB_DIR] = PKGLIBDIR,
[VLC_PKG_DATA_DIR] = PKGDATADIR,
+ [VLC_SYSDATA_DIR] = SYSDATADIR,
};
assert(type < ARRAY_SIZE(dirs));
const char *dir_static = dirs[type];
+ assert(*dir_static != '\0');
/* Look for common static prefix. */
size_t prefix_len = 0;
while (prefix_len < strlen(LIBDIR)
diff --git a/src/win32/dirs.c b/src/win32/dirs.c
index f75002072e..3444384bfe 100644
--- a/src/win32/dirs.c
+++ b/src/win32/dirs.c
@@ -214,7 +214,7 @@ static char *config_GetDataDir(void)
char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
{
- char *dir;
+ char *dir = NULL;
switch (type)
{
@@ -224,6 +224,8 @@ char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
case VLC_PKG_LIB_DIR:
dir = config_GetLibDir();
break;
+ case VLC_SYSDATA_DIR:
+ break;
default:
vlc_assert_unreachable();
}
More information about the vlc-commits
mailing list