chroma: chain: favor YUV10 if output is YUV10
[vlc.git] / src / os2 / dirs.c
blobaa364ed23ea029d90b2d2f1daf48715b942d174d
1 /*****************************************************************************
2 * dirs.c: OS/2 directories configuration
3 *****************************************************************************
4 * Copyright (C) 2010 VLC authors and VideoLAN
6 * Authors: KO Myung-Hun <komh@chollian.net>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
27 #include <vlc_common.h>
29 #include "../libvlc.h"
30 #include <vlc_charset.h>
31 #include "config/configuration.h"
33 char *config_GetLibDir (void)
35 HMODULE hmod;
36 CHAR psz_path[CCHMAXPATH + 4];
38 DosQueryModFromEIP( &hmod, NULL, 0, NULL, NULL, ( ULONG )system_Init );
39 DosQueryModuleName( hmod, sizeof( psz_path ), psz_path );
41 /* remove the DLL name */
42 char *slash = strrchr( psz_path, '\\');
43 if( slash == NULL )
44 abort();
45 strcpy(slash + 1, PACKAGE);
46 return FromLocaleDup(psz_path);
49 /**
50 * Determines the shared data directory
52 * @return a nul-terminated string or NULL. Use free() to release it.
54 static char *config_GetDataDir(void)
56 const char *path = getenv ("VLC_DATA_PATH");
57 if (path)
58 return strdup (path);
60 char *datadir = config_GetLibDir();
61 if (datadir)
62 /* replace last lib\vlc with share */
63 strcpy ( datadir + strlen (datadir) - 7, "share");
64 return datadir;
67 char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
69 char *dir = NULL;
71 switch (type)
73 case VLC_PKG_DATA_DIR:
74 dir = config_GetDataDir();
75 break;
76 case VLC_PKG_LIB_DIR:
77 dir = config_GetLibDir();
78 break;
79 case VLC_SYSDATA_DIR:
80 break;
81 case VLC_LOCALE_DIR:
82 dir = config_GetSysPath(VLC_PKG_DATA_DIR, "locale");
83 break;
84 default:
85 vlc_assert_unreachable();
88 if (filename == NULL || unlikely(dir == NULL))
89 return dir;
91 char *path;
92 asprintf(&path, "%s/%s", dir, filename);
93 free(dir);
94 return path;
97 static char *config_GetHomeDir (void)
99 const char *home = getenv ("HOME");
100 if (home != NULL)
101 return FromLocaleDup (home);
103 return config_GetLibDir();
106 char *config_GetUserDir (vlc_userdir_t type)
108 switch (type)
110 case VLC_HOME_DIR:
111 case VLC_CONFIG_DIR:
112 case VLC_USERDATA_DIR:
113 case VLC_CACHE_DIR:
114 case VLC_DESKTOP_DIR:
115 case VLC_DOWNLOAD_DIR:
116 case VLC_TEMPLATES_DIR:
117 case VLC_PUBLICSHARE_DIR:
118 case VLC_DOCUMENTS_DIR:
119 case VLC_MUSIC_DIR:
120 case VLC_PICTURES_DIR:
121 case VLC_VIDEOS_DIR:
122 break;
124 return config_GetHomeDir ();