]> git.sesse.net Git - vlc/commitdiff
Inline config_GetDataDir()
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 20 Mar 2012 18:48:34 +0000 (20:48 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 20 Mar 2012 18:50:01 +0000 (20:50 +0200)
dirs.c is too simple to grant a file of its own, I think.

src/Makefile.am
src/config/configuration.h
src/config/dirs.c [deleted file]
src/modules/textdomain.c
src/os2/dirs.c
src/posix/darwin_dirs.c
src/posix/dirs.c
src/posix/linux_specific.c
src/symbian/dirs.c
src/win32/dirs.c

index cd06794d2d286fee808dcdad3ac2231d275a2ad4..24632acac83da413a93cf3566bae1a97de7ff9c2 100644 (file)
@@ -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 \
index 0c60508f97f0eaeb7fc5aea9fb40e56e521cee3e..8c694d7b81bd9c0be57c29bf953ea857ff26c38b 100644 (file)
@@ -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 (file)
index 4c1d00f..0000000
+++ /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();
-}
-
index bd8d6e4fe2cf6e53b06b06d6f64399f673cfd729..3bf40901d2532caf32d331103c5cbe9d62edfe3a 100644 (file)
@@ -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;
 
index c710b124bc129e328aac19b3af7a9534cec5c99d..d4a7669445acc58f686d30f23d48e92e02fa6e8e 100644 (file)
@@ -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;
 }
 
index a373971a74bd4a8e8cb445ae9e653793b145fdc8..0216ab680af4e0d8ed48f4916e3a99c5dd90d963 100644 (file)
@@ -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;
 
index 87c785728e7e93a3592a22505ed4f4b8a33f43c1..7c6756642c15def7bfa837149e5763f726d49411 100644 (file)
  *
  * @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);
 }
 
 /**
index f7d8290b48aa6d62c40c9644b4d41a4fd829a9b3..78d9130852031f28a01928d19e2dafaa49227630 100644 (file)
@@ -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)
index 6a9c9df6fa8d0318e8233287bf09c66f0669032d..8413015c815c2335329d75da2a40956efc4f4cc2 100644 (file)
@@ -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();
 }
index d874c85e7e78e4c834c830a4ee53f5b8f2a23873..04e5bb7cc468e9cbc8723259a65c4a4a436bf5f9 100644 (file)
@@ -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)