Changeset 16f32e1500887c0dcd33cb06ad71759a81a52878
- Timestamp:
- 09/09/07 18:10:45 (10 months ago)
- git-parent:
- Files:
-
- NEWS (modified) (1 diff)
- include/main.h (modified) (1 diff)
- include/vlc_config.h (modified) (1 diff)
- modules/access_filter/record.c (modified) (1 diff)
- modules/control/http/util.c (modified) (1 diff)
- modules/gui/skins2/win32/win32_factory.cpp (modified) (1 diff)
- modules/gui/skins2/x11/x11_factory.cpp (modified) (1 diff)
- modules/misc/gnutls.c (modified) (3 diffs)
- modules/misc/logger.c (modified) (1 diff)
- modules/misc/lua/vlclua.c (modified) (1 diff)
- src/control/media_library.c (modified) (1 diff)
- src/input/meta.c (modified) (2 diffs)
- src/libvlc-common.c (modified) (2 diffs)
- src/modules/configuration.c (modified) (7 diffs)
- src/modules/configuration.h (modified) (1 diff)
- src/modules/modules.c (modified) (6 diffs)
- src/playlist/loadsave.c (modified) (4 diffs)
- src/video_output/vout_intf.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
NEWS
r65cd4a4 r16f32e1 112 112 finished: http://wiki.xmms2.xmms.se/index.php/Media_Player_Interfaces . 113 113 * Motion module use disk accelerometers to keep video horizontal 114 115 Linux Port: 116 * VLC now complies with the XDG Base Directory Specification version 0.6 117 http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html 118 (which means that VLC doesn't use the $HOME/.vlc directory anymore) 114 119 115 120 Capture: include/main.h
r2e0409a r16f32e1 39 39 int i_argc; ///< command line arguments count 40 40 char ** ppsz_argv; ///< command line arguments 41 char * psz_homedir; ///< configuration directory 42 char * psz_userdir; ///< user's home directory 41 42 char * psz_homedir; ///< user's home directory 43 char * psz_configdir; ///< user's configuration directory 44 char * psz_datadir; ///< user's data/cache directory 45 43 46 char * psz_configfile; ///< location of config file 44 47 include/vlc_config.h
rfbf4c80 r16f32e1 48 48 * outputting an error message (in second) */ 49 49 #define THREAD_COND_TIMEOUT 1 50 51 /* The configuration file and directory */52 #if defined (SYS_BEOS)53 # define CONFIG_DIR "config/settings/VideoLAN Client"54 #elif defined (__APPLE__)55 # define CONFIG_DIR "Library/Preferences/VLC"56 #elif defined( WIN32 ) || defined( UNDER_CE )57 # define CONFIG_DIR "vlc"58 #else59 # define CONFIG_DIR ".vlc"60 #endif61 #define CONFIG_FILE "vlcrc"62 #define PLUGINSCACHE_DIR "cache"63 50 64 51 /***************************************************************************** modules/access_filter/record.c
rb75e050 r16f32e1 149 149 { 150 150 free( psz ); 151 if( p_access->p_libvlc->psz_homedir ) 151 if( p_access->p_libvlc->psz_homedir ) /* XXX: This should never happen */ 152 152 psz = strdup( p_access->p_libvlc->psz_homedir ); 153 153 } modules/control/http/util.c
r45444ce r16f32e1 990 990 char *dir; 991 991 /* This is incomplete : we should also support the ~cmassiot/ syntax. */ 992 asprintf( &dir, "%s%s", p_intf->p_libvlc->psz_ userdir, psz_dir + 1 );992 asprintf( &dir, "%s%s", p_intf->p_libvlc->psz_homedir, psz_dir + 1 ); 993 993 free( psz_dir ); 994 994 psz_dir = dir; modules/gui/skins2/win32/win32_factory.cpp
r3ea2708 r16f32e1 226 226 227 227 // Initialize the resource path 228 m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_ homedir +229 "\\ " + CONFIG_DIR + "\\skins" );230 m_resourcePath.push_back( ( string)config_GetDataDir() +228 m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_datadir + 229 "\\skins" ); 230 m_resourcePath.push_back( (dstring)config_GetDataDir() + 231 231 "\\skins" ); 232 232 m_resourcePath.push_back( (string)config_GetDataDir() + modules/gui/skins2/x11/x11_factory.cpp
r65e0358 r16f32e1 72 72 73 73 // Initialize the resource path 74 m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_ homedir +75 m_dirSep + CONFIG_DIR+ "/skins2" );74 m_resourcePath.push_back( (string)getIntf()->p_libvlc->psz_datadir + 75 + "/skins2" ); 76 76 m_resourcePath.push_back( (string)"share/skins2" ); 77 77 m_resourcePath.push_back( (string)DATA_PATH + "/skins2" ); modules/misc/gnutls.c
r8917f56 r16f32e1 703 703 vlc_object_attach( p_session, p_tls ); 704 704 705 const char *homedir = p_tls->p_libvlc->psz_ homedir,705 const char *homedir = p_tls->p_libvlc->psz_datadir, 706 706 *datadir = config_GetDataDir (); 707 707 size_t l1 = strlen (homedir), l2 = strlen (datadir); 708 char path[((l1 > l2) ? l1 : l2) + sizeof ("/ "CONFIG_DIR"/ssl/private")];709 // > sizeof ("/ "CONFIG_DIR"/ssl/certs")708 char path[((l1 > l2) ? l1 : l2) + sizeof ("/ssl/private")]; 709 // > sizeof ("/ssl/certs") 710 710 // > sizeof ("/ca-certificates.crt") 711 711 … … 720 720 if (var_CreateGetBool (p_tls, "tls-check-cert")) 721 721 { 722 sprintf (path, "%s/ "CONFIG_DIR"/ssl/certs", homedir);722 sprintf (path, "%s/ssl/certs", homedir); 723 723 gnutls_Addx509Directory ((vlc_object_t *)p_session, 724 724 p_sys->x509_cred, path, VLC_FALSE); … … 732 732 p_session->pf_handshake2 = gnutls_ContinueHandshake; 733 733 734 sprintf (path, "%s/ "CONFIG_DIR"/ssl/private", homedir);734 sprintf (path, "%s/ssl/private", homedir); 735 735 gnutls_Addx509Directory ((vlc_object_t *)p_session, p_sys->x509_cred, 736 736 path, VLC_TRUE); modules/misc/logger.c
r1b67b68 r16f32e1 202 202 char *psz_homedir = p_this->p_libvlc->psz_homedir; 203 203 204 if( !psz_homedir ) 204 if( !psz_homedir ) /* XXX: This should never happen */ 205 205 { 206 206 msg_Err( p_this, "unable to find home directory" ); modules/misc/lua/vlclua.c
ra9a8900 r16f32e1 246 246 char **ppsz_dir; 247 247 248 if( asprintf( &ppsz_dir_list[0], "%s" DIR_SEP CONFIG_DIR DIR_SEP "%s", p_this->p_libvlc->psz_homedir,249 luadirname ) < 0 )248 if( asprintf( &ppsz_dir_list[0], "%s" DIR_SEP "%s", 249 p_this->p_libvlc->psz_datadir, luadirname ) < 0 ) 250 250 return VLC_ENOMEM; 251 251 src/control/media_library.c
r7fecb1e r16f32e1 89 89 libvlc_exception_t * p_e ) 90 90 { 91 const char *psz_ homedir = p_mlib->p_libvlc_instance->p_libvlc_int->psz_homedir;91 const char *psz_datadir = p_mlib->p_libvlc_instance->p_libvlc_int->psz_datadir; 92 92 char * psz_uri; 93 93 94 if( !psz_ homedir )94 if( !psz_datadir ) /* XXX: i doubt that this can ever happen */ 95 95 { 96 libvlc_exception_raise( p_e, "Can't get HOME DIR" );96 libvlc_exception_raise( p_e, "Can't get data directory" ); 97 97 return; 98 98 } 99 99 100 if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP CONFIG_DIR DIR_SEP101 "ml.xsp", psz_homedir ) == -1 )100 if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp", 101 psz_datadir ) == -1 ) 102 102 { 103 103 libvlc_exception_raise( p_e, "Can't get create the path" ); src/input/meta.c
r10f0097 r16f32e1 274 274 char * psz_artist_sanitized = ArtCacheGetSanitizedFileName( psz_artist ); 275 275 276 snprintf( psz_dir, MAX_PATH, "%s" DIR_SEP CONFIG_DIR DIR_SEP276 snprintf( psz_dir, MAX_PATH, "%s" DIR_SEP 277 277 "art" DIR_SEP "artistalbum" DIR_SEP "%s" DIR_SEP "%s", 278 p_obj->p_libvlc->psz_ homedir,278 p_obj->p_libvlc->psz_datadir, 279 279 psz_artist_sanitized, psz_album_sanitized ); 280 280 free( psz_album_sanitized ); … … 284 284 { 285 285 char * psz_title_sanitized = ArtCacheGetSanitizedFileName( psz_title ); 286 snprintf( psz_dir, MAX_PATH, "%s" DIR_SEP CONFIG_DIR DIR_SEP286 snprintf( psz_dir, MAX_PATH, "%s" DIR_SEP 287 287 "art" DIR_SEP "title" DIR_SEP "%s", 288 p_obj->p_libvlc->psz_ homedir,288 p_obj->p_libvlc->psz_datadir, 289 289 psz_title_sanitized ); 290 290 free( psz_title_sanitized ); src/libvlc-common.c
r56040f0 r16f32e1 326 326 327 327 /* Set the config file stuff */ 328 p_libvlc->psz_homedir = config_GetHomeDir(); 329 p_libvlc->psz_userdir = config_GetUserDir(); 330 if( p_libvlc->psz_userdir == NULL ) 331 p_libvlc->psz_userdir = strdup(p_libvlc->psz_homedir); 332 p_libvlc->psz_configfile = config_GetPsz( p_libvlc, "config" ); 333 if( (p_libvlc->psz_configfile != NULL) && (p_libvlc->psz_configfile[0] == '~') 334 && (p_libvlc->psz_configfile[1] == '/') ) 335 { 336 char *psz = malloc( strlen(p_libvlc->psz_userdir) 337 + strlen(p_libvlc->psz_configfile) ); 338 if( psz ) 339 { 340 /* This is incomplete : we should also support the ~cmassiot/ syntax. */ 341 sprintf( psz, "%s/%s", p_libvlc->psz_userdir, 342 p_libvlc->psz_configfile + 2 ); 343 free( p_libvlc->psz_configfile ); 344 p_libvlc->psz_configfile = psz; 345 } /* else keep old config stuff */ 346 } 328 p_libvlc->psz_homedir = config_GetHomeDir(); 329 p_libvlc->psz_configdir = config_GetConfigDir( p_libvlc ); 330 p_libvlc->psz_datadir = config_GetUserDataDir( p_libvlc ); 331 p_libvlc->psz_configfile = config_GetCustomConfigFile( p_libvlc ); 347 332 348 333 /* Check for plugins cache options */ … … 1068 1053 1069 1054 FREENULL( p_libvlc->psz_homedir ); 1070 FREENULL( p_libvlc->psz_userdir ); 1055 FREENULL( p_libvlc->psz_configdir ); 1056 FREENULL( p_libvlc->psz_datadir ); 1071 1057 FREENULL( p_libvlc->psz_configfile ); 1072 1058 FREENULL( p_libvlc->p_hotkeys ); src/modules/configuration.c
r56bdc14 r16f32e1 85 85 int IsConfigStringType (int type) 86 86 { 87 static const unsigned char config_types[] = 87 static const unsigned char config_types[] = 88 88 { 89 89 CONFIG_ITEM_STRING, CONFIG_ITEM_FILE, CONFIG_ITEM_MODULE, … … 99 99 static int IsConfigIntegerType (int type) 100 100 { 101 static const unsigned char config_types[] = 101 static const unsigned char config_types[] = 102 102 { 103 103 CONFIG_ITEM_INTEGER, CONFIG_ITEM_KEY, CONFIG_ITEM_BOOL, … … 787 787 static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode ) 788 788 { 789 static const char psz_subpath[] = DIR_SEP CONFIG_DIR DIR_SEP CONFIG_FILE; 790 const char *psz_filename = p_obj->p_libvlc->psz_configfile; 791 const char *psz_homedir = p_obj->p_libvlc->psz_homedir; 792 size_t i_buflen = 0; 789 char *psz_filename = p_obj->p_libvlc->psz_configfile; 793 790 FILE *p_stream; 794 791 795 if( psz_filename == NULL ) 796 { 797 if( psz_homedir == NULL ) 798 { 799 msg_Err( p_obj, "no home directory defined" ); 800 return NULL; 801 } 802 803 i_buflen = strlen(psz_homedir) + sizeof(psz_subpath) + 1; 804 } 805 806 char buf[i_buflen]; 807 if( psz_filename == NULL ) 808 { 809 sprintf( buf, "%s%s", psz_homedir, psz_subpath ); 810 psz_filename = buf; 792 if( !psz_filename ) 793 { 794 psz_filename = config_GetConfigFile( p_obj->p_libvlc ); 811 795 } 812 796 813 797 msg_Dbg( p_obj, "opening config file (%s)", psz_filename ); 798 814 799 p_stream = utf8_fopen( psz_filename, mode ); 815 800 if( p_stream == NULL && errno != ENOENT ) 816 msg_Err( p_obj, "cannot open config file (%s): %s", psz_filename, strerror(errno) ); 801 { 802 msg_Err( p_obj, "cannot open config file (%s): %s", 803 psz_filename, strerror(errno) ); 804 805 } 806 #if !( defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) ) 807 else if( p_stream == NULL && errno == ENOENT && mode[0] == 'r' ) 808 { 809 /* This is the fallback for pre XDG Base Directory 810 * Specification configs */ 811 char *psz_old; 812 if( asprintf( &psz_old, "%s" DIR_SEP CONFIG_DIR DIR_SEP CONFIG_FILE, 813 p_obj->p_libvlc->psz_homedir ) != -1 ) 814 { 815 p_stream = utf8_fopen( psz_old, mode ); 816 if( p_stream ) 817 { 818 /* Old config file found. We want to write it at the 819 * new location now. */ 820 msg_Info( p_obj->p_libvlc, "Found old config file at %s. " 821 "VLC will now use %s.", psz_old, psz_filename ); 822 char *psz_readme; 823 if( asprintf(&psz_readme,"%s"DIR_SEP CONFIG_DIR DIR_SEP"README", 824 p_obj->p_libvlc->psz_homedir ) != -1 ) 825 { 826 FILE *p_readme = utf8_fopen( psz_readme, "wt" ); 827 if( p_readme ) 828 { 829 fputs( "The VLC media player configuration folder has " 830 "moved to comply with the XDG Base " 831 "Directory Specification version 0.6. Your " 832 "configuration has been copied to the new " 833 "location (", p_readme ); 834 fputs( p_obj->p_libvlc->psz_configdir, p_readme ); 835 fputs( "). You can delete this directory and " 836 "all its contents.", p_readme ); 837 fclose( p_readme ); 838 } 839 free( psz_readme ); 840 } 841 } 842 free( psz_old ); 843 } 844 } 845 #endif 846 else if( p_stream != NULL ) 847 { 848 p_obj->p_libvlc->psz_configfile = psz_filename; 849 } 817 850 818 851 return p_stream; … … 1018 1051 if( utf8_mkdir( psz_dirname ) && ( errno != EEXIST ) ) 1019 1052 { 1053 if( errno == ENOENT ) 1054 { 1055 /* Let's try to create the parent directory */ 1056 char *psz_parent = strdup( psz_dirname ); 1057 char *psz_end = strrchr( psz_parent, DIR_SEP_CHAR ); 1058 if( psz_end && psz_end != psz_parent ) 1059 { 1060 *psz_end = '\0'; 1061 if( config_CreateDir( p_this, psz_parent ) == 0 ) 1062 { 1063 if( !utf8_mkdir( psz_dirname ) ) 1064 { 1065 free( psz_parent ); 1066 return 0; 1067 } 1068 } 1069 } 1070 free( psz_parent ); 1071 } 1020 1072 msg_Err( p_this, "could not create %s (%s)", 1021 1073 psz_dirname, strerror(errno) ); … … 1060 1112 vlc_mutex_lock( &p_this->p_libvlc->config_lock ); 1061 1113 1062 if (p_this->p_libvlc->psz_configfile == NULL)1063 { 1064 const char *psz_ homedir = p_this->p_libvlc->psz_homedir;1065 if( !psz_ homedir )1066 { 1067 msg_Err( p_this, "no homedirectory defined" );1114 if( p_this->p_libvlc->psz_configfile == NULL ) 1115 { 1116 const char *psz_configdir = p_this->p_libvlc->psz_configdir; 1117 if( !psz_configdir ) /* XXX: This should never happen */ 1118 { 1119 msg_Err( p_this, "no configuration directory defined" ); 1068 1120 vlc_mutex_unlock( &p_this->p_libvlc->config_lock ); 1069 1121 return -1; 1070 1122 } 1071 1123 1072 char dirname[strlen (psz_homedir) + sizeof (DIR_SEP CONFIG_DIR)]; 1073 sprintf (dirname, "%s" DIR_SEP CONFIG_DIR, psz_homedir); 1074 config_CreateDir (p_this, dirname); 1075 } 1076 1077 file = config_OpenConfigFile (p_this, "rt"); 1078 if (file != NULL) 1124 config_CreateDir( p_this, psz_configdir ); 1125 } 1126 1127 file = config_OpenConfigFile( p_this, "rt" ); 1128 if( file != NULL ) 1079 1129 { 1080 1130 /* look for file size */ … … 1579 1629 return -1; 1580 1630 } 1581 1631 1582 1632 psz_name = (char *)p_conf->psz_current; 1583 1633 p_conf = config_FindConfig( p_this, psz_name ); … … 1816 1866 } 1817 1867 1868 /** 1869 * Get the user's home directory 1870 */ 1818 1871 char *config_GetHomeDir( void ) 1819 1872 { 1873 return GetDir( VLC_FALSE ); 1874 } 1875 1876 /** 1877 * Get the user's main data and config directory: 1878 * - on windows that's the App Data directory; 1879 * - on other OSes it's the same as the home directory. 1880 */ 1881 char *config_GetUserDir( void ); 1882 char *config_GetUserDir( void ) 1883 { 1820 1884 return GetDir( VLC_TRUE ); 1821 1885 } 1822 1886 1823 char *config_GetUserDir( void ) 1824 { 1825 return GetDir( VLC_FALSE ); 1826 } 1827 1887 /** 1888 * Get the user's VLC configuration directory 1889 */ 1890 char *config_GetConfigDir( libvlc_int_t *p_libvlc ) 1891 { 1892 char *psz_dir; 1893 #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) 1894 char *psz_parent = config_GetUserDir(); 1895 if( !psz_parent ) psz_parent = p_libvlc->psz_homedir; 1896 if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 ) 1897 return NULL; 1898 return psz_dir; 1899 #else 1900 /* XDG Base Directory Specification - Version 0.6 */ 1901 char *psz_env = getenv( "XDG_CONFIG_HOME" ); 1902 if( psz_env ) 1903 { 1904 if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 ) 1905 return NULL; 1906 return psz_dir; 1907 } 1908 psz_env = getenv( "HOME" ); 1909 if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */ 1910 if( asprintf( &psz_dir, "%s/.config/vlc", psz_env ) == -1 ) 1911 return NULL; 1912 return psz_dir; 1913 #endif 1914 } 1915 1916 /** 1917 * Get the user's VLC data and cache directory 1918 * (used for stuff like the modules cache, the album art cache, ...) 1919 */ 1920 char *config_GetUserDataDir( libvlc_int_t *p_libvlc ) 1921 { 1922 char *psz_dir; 1923 #if defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) 1924 char *psz_parent = config_GetUserDir(); 1925 if( !psz_parent ) psz_parent = p_libvlc->psz_homedir; 1926 if( asprintf( &psz_dir, "%s" DIR_SEP CONFIG_DIR, psz_parent ) == -1 ) 1927 return NULL; 1928 return psz_dir; 1929 #else 1930 /* XDG Base Directory Specification - Version 0.6 */ 1931 char *psz_env = getenv( "XDG_DATA_HOME" ); 1932 if( psz_env ) 1933 { 1934 if( asprintf( &psz_dir, "%s/vlc", psz_env ) == -1 ) 1935 return NULL; 1936 return psz_dir; 1937 } 1938 psz_env = getenv( "HOME" ); 1939 if( !psz_env ) psz_env = p_libvlc->psz_homedir; /* not part of XDG spec but we want a sensible fallback */ 1940 if( asprintf( &psz_dir, "%s/.local/share/vlc", psz_env ) == -1 ) 1941 return NULL; 1942 return psz_dir; 1943 #endif 1944 } 1945 1946 /** 1947 * Get the user's configuration file 1948 */ 1949 char *config_GetConfigFile( libvlc_int_t *p_libvlc ) 1950 { 1951 char *psz_configfile; 1952 if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE, 1953 p_libvlc->psz_configdir ) == -1 ) 1954 return NULL; 1955 return psz_configfile; 1956 } 1957 1958 /** 1959 * Get the user's configuration file when given with the --config option 1960 */ 1961 char *config_GetCustomConfigFile( libvlc_int_t *p_libvlc ) 1962 { 1963 char *psz_configfile = config_GetPsz( p_libvlc, "config" ); 1964 if( psz_configfile != NULL ) 1965 { 1966 if( psz_configfile[0] == '~' && psz_configfile[1] == '/' ) 1967 { 1968 /* This is incomplete: we should also support the ~cmassiot/ syntax */ 1969 char *psz_buf; 1970 if( asprintf( &psz_buf, "%s/%s", p_libvlc->psz_homedir, 1971 psz_configfile + 2 ) == -1 ) 1972 { 1973 free( psz_configfile ); 1974 return NULL; 1975 } 1976 free( psz_configfile ); 1977 psz_configfile = psz_buf; 1978 } 1979 } 1980 return psz_configfile; 1981 } 1828 1982 1829 1983 static int ConfigStringToKey( const char *psz_key ) src/modules/configuration.h
rb8802c3 r16f32e1 34 34 35 35 void config_SetCallbacks( module_config_t *, module_config_t *, size_t ); 36 void config_UnsetCallbacks ( module_config_t *, size_t );36 void config_UnsetCallbacks( module_config_t *, size_t ); 37 37 38 38 #define config_LoadCmdLine(a,b,c,d) __config_LoadCmdLine(VLC_OBJECT(a),b,c,d) 39 39 #define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b) 40 40 41 int __config_LoadCmdLine ( vlc_object_t *, int *, char *[], vlc_bool_t ); 42 char * config_GetHomeDir ( void ); 43 char * config_GetUserDir ( void ); 44 int __config_LoadConfigFile ( vlc_object_t *, const char * ); 41 int __config_LoadCmdLine ( vlc_object_t *, int *, char *[], vlc_bool_t ); 42 char *config_GetHomeDir ( void ); 43 char *config_GetConfigDir ( libvlc_int_t * ); 44 char *config_GetUserDataDir( libvlc_int_t * ); 45 char *config_GetConfigFile ( libvlc_int_t * ); 46 char *config_GetCustomConfigFile( libvlc_int_t * ); 47 int __config_LoadConfigFile( vlc_object_t *, const char * ); 45 48 46 int IsConfigStringType (int type); 49 int IsConfigStringType( int type ); 50 51 /* The configuration file and directory */ 52 #if defined (SYS_BEOS) 53 # define CONFIG_DIR "config/settings/VideoLAN Client" 54 #elif defined (__APPLE__) 55 # define CONFIG_DIR "Library/Preferences/VLC" 56 #elif defined( WIN32 ) || defined( UNDER_CE ) 57 # define CONFIG_DIR "vlc" 58 #else 59 # define CONFIG_DIR ".vlc" 60 #endif 61 #define CONFIG_FILE "vlcrc" 62 #define PLUGINSCACHE_DIR "cache" 47 63 48 64 # ifdef __cplusplus src/modules/modules.c
rf73343d r16f32e1 1666 1666 static void CacheLoad( vlc_object_t *p_this ) 1667 1667 { 1668 char *psz_filename, *psz_ homedir;1668 char *psz_filename, *psz_datadir; 1669 1669 FILE *file; 1670 1670 int i, j, i_size, i_read; … … 1676 1676 libvlc_global_data_t *p_libvlc_global = vlc_global(); 1677 1677 1678 psz_ homedir = p_this->p_libvlc->psz_homedir;1679 if( !psz_ homedir )1680 { 1681 msg_Err( p_this, " psz_homedir is null" );1682 return; 1683 } 1684 1685 i_size = asprintf( &psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s" DIR_SEP"%s",1686 psz_ homedir, CONFIG_DIR, PLUGINSCACHE_DIR, CacheName() );1678 psz_datadir = p_this->p_libvlc->psz_datadir; 1679 if( !psz_datadir ) /* XXX: this should never happen */ 1680 { 1681 msg_Err( p_this, "Unable to get cache directory" ); 1682 return; 1683 } 1684 1685 i_size = asprintf( &psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s", 1686 psz_datadir, PLUGINSCACHE_DIR, CacheName() ); 1687 1687 if( i_size <= 0 ) 1688 1688 { … … 2023 2023 "# http://www.brynosaurus.com/cachedir/\r\n"; 2024 2024 2025 char *psz_filename, *psz_ homedir;2025 char *psz_filename, *psz_datadir; 2026 2026 FILE *file; 2027 2027 int i, j, i_cache; … … 2030 2030 libvlc_global_data_t *p_libvlc_global = vlc_global(); 2031 2031 2032 psz_homedir = p_this->p_libvlc->psz_homedir; 2033 if( !psz_homedir ) 2034 { 2035 msg_Err( p_this, "psz_homedir is null" ); 2036 return; 2037 } 2032 psz_datadir = p_this->p_libvlc->psz_datadir; 2033 if( !psz_datadir ) /* XXX: this should never happen */ 2034 { 2035 msg_Err( p_this, "Unable to get cache directory" ); 2036 return; 2037 } 2038 2038 2039 psz_filename = 2039 (char *)malloc( sizeof(DIR_SEP CONFIG_DIR DIR_SEPPLUGINSCACHE_DIR DIR_SEP ) +2040 strlen(psz_ homedir) + strlen(CacheName()) );2040 (char *)malloc( sizeof(DIR_SEP PLUGINSCACHE_DIR DIR_SEP ) + 2041 strlen(psz_datadir) + strlen(CacheName()) ); 2041 2042 2042 2043 if( !psz_filename ) … … 2046 2047 } 2047 2048 2048 sprintf( psz_filename, "%s" DIR_SEP"%s", psz_homedir, CONFIG_DIR);2049 sprintf( psz_filename, "%s", psz_datadir ); 2049 2050 2050 2051 config_CreateDir( p_this, psz_filename ); … … 2063 2064 } 2064 2065 2065 sprintf( psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s" DIR_SEP"%s", psz_homedir, CONFIG_DIR,2066 sprintf( psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s", psz_datadir, 2066 2067 PLUGINSCACHE_DIR, CacheName() ); 2067 2068 src/playlist/loadsave.c
r92ebfe8 r16f32e1 90 90 int playlist_MLLoad( playlist_t *p_playlist ) 91 91 { 92 const char *psz_ homedir = p_playlist->p_libvlc->psz_homedir;92 const char *psz_datadir = p_playlist->p_libvlc->psz_datadir; 93 93 char *psz_uri = NULL; 94 94 input_item_t *p_input; 95 95 96 96 if( !config_GetInt( p_playlist, "media-library") ) return VLC_SUCCESS; 97 if( !psz_ homedir )97 if( !psz_datadir ) /* XXX: This should never happen */ 98 98 { 99 msg_Err( p_playlist, "no homedirectory, cannot load media library") ;99 msg_Err( p_playlist, "no data directory, cannot load media library") ; 100 100 return VLC_EGENERIC; 101 101 } 102 102 103 if( asprintf( &psz_uri, "%s" DIR_SEP CONFIG_DIR DIR_SEP 104 "ml.xsp", psz_homedir ) == -1 ) 103 if( asprintf( &psz_uri, "%s" DIR_SEP "ml.xsp", psz_datadir ) == -1 ) 105 104 { 106 105 psz_uri = NULL; … … 116 115 free( psz_uri ); 117 116 118 if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP CONFIG_DIR DIR_SEP119 "ml.xsp", psz_homedir ) == -1 )117 if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp", 118 psz_datadir ) == -1 ) 120 119 { 121 120 psz_uri = NULL; … … 147 146 int playlist_MLDump( playlist_t *p_playlist ) 148 147 { 149 char *psz_ homedir = p_playlist->p_libvlc->psz_homedir;148 char *psz_datadir = p_playlist->p_libvlc->psz_datadir; 150 149 if( !config_GetInt( p_playlist, "media-library") ) return VLC_SUCCESS; 151 if( !psz_ homedir )150 if( !psz_datadir ) /* XXX: This should never happen */ 152 151 { 153 msg_Err( p_playlist, "no homedirectory, cannot save media library") ;152 msg_Err( p_playlist, "no data directory, cannot save media library") ; 154 153 return VLC_EGENERIC; 155 154 } 156 155 157 char psz_dirname[ strlen( psz_ homedir )158 + sizeof( DIR_SEP CONFIG_DIR DIR_SEP"ml.xsl")];159 sprintf( psz_dirname, "%s" DIR_SEP CONFIG_DIR, psz_homedir );156 char psz_dirname[ strlen( psz_datadir ) 157 + sizeof( DIR_SEP "ml.xsl")]; 158 sprintf( psz_dirname, "%s", psz_datadir ); 160 159 if( config_CreateDir( (vlc_object_t *)p_playlist, psz_dirname ) ) 161 160 { … … 164 163 165 164 strcat( psz_dirname, DIR_SEP "ml.xsp" ); 166 165 167 166 stats_TimerStart( p_playlist, "ML Dump", STATS_TIMER_ML_DUMP ); 168 167 playlist_Export( p_playlist, psz_dirname, p_playlist->p_ml_category, src/video_output/vout_intf.c
rf3b32f6 r16f32e1 620 620 if( p_mypicturesdir == NULL ) 621 621 { 622 if( asprintf( &val.psz_string, "%s \\" CONFIG_DIR,622 if( asprintf( &val.psz_string, "%s", 623 623 p_vout->p_libvlc->psz_homedir ) == -1 ) 624 624 val.psz_string = NULL; … … 633 633 634 634 #else 635 if( !val.psz_string && p_vout->p_libvlc->psz_homedir ) 636 { 637 if( asprintf( &val.psz_string, "%s/" CONFIG_DIR, 638 p_vout->p_libvlc->psz_homedir ) == -1 ) 635 /* XXX: This saves in the data directory. Shouldn't we try saving 636 * to psz_homedir/Desktop or something nicer ? */ 637 if( !val.psz_string && p_vout->p_libvlc->psz_datadir ) 638 { 639 if( asprintf( &val.psz_string, "%s", 640 p_vout->p_libvlc->psz_datadir ) == -1 ) 639 641 val.psz_string = NULL; 640 642 }
