1 /*****************************************************************************
2 * dirs_macos.c: Mac OS X directories configuration
3 *****************************************************************************
4 * Copyright (C) 2001-2009 the VideoLAN team
5 * Copyright © 2007-2009 Rémi Denis-Courmont
7 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * Felix Paul Kühne <fkuehne at videolan dot org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
29 #include <vlc_common.h>
31 #include "../libvlc.h"
32 #include <vlc_charset.h>
33 #include <vlc_configuration.h>
36 const char *config_GetConfDir( void )
38 return config_GetUserDir (VLC_CONFIG_DIR);
41 const char *config_GetDataDir (void)
43 return config_GetUserDir (VLC_DATA_DIR);
46 static char *config_GetHomeDir (void)
49 const char *home = getenv ("HOME");
54 return FromLocaleDup (home);
57 static char *config_GetAppDir (void)
59 return config_GetUserDir (VLC_CONFIG_DIR);
62 char *config_GetUserDir (vlc_userdir_t type)
65 const char *psz_parent = config_GetHomeDir ();
71 psz_path = "%s/Library/Preferences/VLC";
73 case VLC_TEMPLATES_DIR:
75 psz_path = "%s/Library/Application Support/VLC";
78 psz_path = "%s/Desktop";
80 case VLC_DOWNLOAD_DIR:
81 psz_path = "%s/Downloads";
83 case VLC_DOCUMENTS_DIR:
84 psz_path = "%s/Documents";
87 psz_path = "%s/Music";
89 case VLC_PICTURES_DIR:
90 psz_path = "%s/Pictures";
93 psz_path = "%s/Movies";
95 case VLC_PUBLICSHARE_DIR:
96 psz_path = "%s/Public";
99 psz_path = "%s/Library/Caches/org.videolan.vlc";
105 if( asprintf( &psz_dir, psz_path, psz_parent ) == -1 )