[vlc-commits] Inline config_GetDataDir()
Rémi Denis-Courmont
git at videolan.org
Tue Mar 20 19:50:24 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 20 20:48:34 2012 +0200| [98e87c5c0012e5492df8a3dfcbd5971c7ed11a22] | committer: Rémi Denis-Courmont
Inline config_GetDataDir()
dirs.c is too simple to grant a file of its own, I think.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98e87c5c0012e5492df8a3dfcbd5971c7ed11a22
---
src/Makefile.am | 1 -
src/config/configuration.h | 2 -
src/config/dirs.c | 45 --------------------------------------------
src/modules/textdomain.c | 3 +-
src/os2/dirs.c | 8 ++++--
src/posix/darwin_dirs.c | 6 ++++-
src/posix/dirs.c | 5 ++-
src/posix/linux_specific.c | 2 +-
src/symbian/dirs.c | 2 +-
src/win32/dirs.c | 5 ++-
10 files changed, 19 insertions(+), 60 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index cd06794..24632ac 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -437,7 +437,6 @@ SOURCES_libvlc_common = \
config/intf.c \
config/keys.c \
config/cmdline.c \
- config/dirs.c \
config/getopt.c \
config/vlc_getopt.h \
misc/events.c \
diff --git a/src/config/configuration.h b/src/config/configuration.h
index 0c60508..8c694d7 100644
--- a/src/config/configuration.h
+++ b/src/config/configuration.h
@@ -41,8 +41,6 @@ bool config_PrintHelp (vlc_object_t *);
int config_SortConfig (void);
void config_UnsortConfig (void);
-char *config_GetDataDirDefault( void );
-
#define CONFIG_CLASS(x) ((x) & ~0x1F)
static inline bool IsConfigStringType(unsigned type)
diff --git a/src/config/dirs.c b/src/config/dirs.c
deleted file mode 100644
index 4c1d00f..0000000
--- a/src/config/dirs.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * dirs.c: crossplatform directories configuration
- *****************************************************************************
- * Copyright (C) 2009 VLC authors and VideoLAN
- *
- * Authors: Antoine Cellerier <dionoea at videolan dot org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-
-#include "../libvlc.h"
-
-#include "configuration.h"
-
-/**
- * Determines the shared architecture-independent data directory
- *
- * @return a string or NULL. Use free() to release.
- */
-char *config_GetDataDir(void)
-{
- const char *path = getenv ("VLC_DATA_PATH");
- if (path)
- return strdup (path);
- return config_GetDataDirDefault();
-}
-
diff --git a/src/modules/textdomain.c b/src/modules/textdomain.c
index bd8d6e4..3bf4090 100644
--- a/src/modules/textdomain.c
+++ b/src/modules/textdomain.c
@@ -28,7 +28,6 @@
#ifdef ENABLE_NLS
# include <libintl.h>
# if defined (__APPLE__) || defined (WIN32) || defined(__OS2__)
-# include "config/configuration.h"
# include <vlc_charset.h>
# endif
#endif
@@ -46,7 +45,7 @@ int vlc_bindtextdomain (const char *domain)
return -1;
}
# else
- char *datadir = config_GetDataDirDefault();
+ char *datadir = config_GetDataDir();
if (unlikely(datadir == NULL))
return -1;
diff --git a/src/os2/dirs.c b/src/os2/dirs.c
index c710b12..d4a7669 100644
--- a/src/os2/dirs.c
+++ b/src/os2/dirs.c
@@ -51,14 +51,16 @@ char *config_GetLibDir (void)
*
* @return a nul-terminated string or NULL. Use free() to release it.
*/
-char *config_GetDataDirDefault (void)
+char *config_GetDataDir (void)
{
- char *datadir = config_GetLibDir();
+ const char *path = getenv ("VLC_DATA_PATH");
+ if (path)
+ return strdup (path);
+ char *datadir = config_GetLibDir();
if (datadir)
/* replace last lib\vlc with share */
strcpy ( datadir + strlen (datadir) - 7, "share");
-
return datadir;
}
diff --git a/src/posix/darwin_dirs.c b/src/posix/darwin_dirs.c
index a373971..0216ab6 100644
--- a/src/posix/darwin_dirs.c
+++ b/src/posix/darwin_dirs.c
@@ -119,8 +119,12 @@ char *config_GetLibDir (void)
abort ();
}
-char *config_GetDataDirDefault (void)
+char *config_GetDataDir (void)
{
+ const char *path = getenv ("VLC_DATA_PATH");
+ if (path)
+ return strdup (path);
+
char *vlcpath = config_GetLibDir ();
char *datadir;
diff --git a/src/posix/dirs.c b/src/posix/dirs.c
index 87c7857..7c67566 100644
--- a/src/posix/dirs.c
+++ b/src/posix/dirs.c
@@ -41,9 +41,10 @@
*
* @return a nul-terminated string or NULL. Use free() to release it.
*/
-char *config_GetDataDirDefault (void)
+char *config_GetDataDir (void)
{
- return strdup (PKGDATADIR);
+ const char *path = getenv ("VLC_DATA_PATH");
+ return strdup ((path != NULL) ? path : PKGDATADIR);
}
/**
diff --git a/src/posix/linux_specific.c b/src/posix/linux_specific.c
index f7d8290..78d9130 100644
--- a/src/posix/linux_specific.c
+++ b/src/posix/linux_specific.c
@@ -75,7 +75,7 @@ error:
return (path != NULL) ? path : strdup (PKGLIBDIR);
}
-char *config_GetDataDirDefault (void)
+char *config_GetDataDir (void)
{
char *libdir = config_GetLibDir ();
if (libdir == NULL)
diff --git a/src/symbian/dirs.c b/src/symbian/dirs.c
index 6a9c9df..8413015 100644
--- a/src/symbian/dirs.c
+++ b/src/symbian/dirs.c
@@ -40,7 +40,7 @@
*
* @return a null-terminated string or NULL. Use free() to release it.
*/
-char *config_GetDataDirDefault (void)
+char *config_GetDataDir (void)
{
return GetConstPrivatePath();
}
diff --git a/src/win32/dirs.c b/src/win32/dirs.c
index d874c85..04e5bb7 100644
--- a/src/win32/dirs.c
+++ b/src/win32/dirs.c
@@ -63,9 +63,10 @@ error:
abort ();
}
-char *config_GetDataDirDefault( void )
+char *config_GetDataDir (void)
{
- return config_GetLibDir ();
+ const char *path = getenv ("VLC_DATA_PATH");
+ return (path != NULL) ? strdup (path) : config_GetLibDir ();
}
const char *config_GetConfDir (void)
More information about the vlc-commits
mailing list