Commit 0704d00f authored by Geoffroy Couprie's avatar Geoffroy Couprie

Win32: Store the plugins cache in c:\ProgramData\VideoLAN\VLC, run...

Win32: Store the plugins cache in c:\ProgramData\VideoLAN\VLC, run vlc-cache-gen.exe at install time, and as a bonus, fixes #3308
parent 6ff5a488
...@@ -314,6 +314,14 @@ FunctionEnd ...@@ -314,6 +314,14 @@ FunctionEnd
; 3. Delete prefs and cache ; ; 3. Delete prefs and cache ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
!macro gencache
SetShellVarContext all
CreateDirectory "$APPDATA\\VideoLAN"
CreateDirectory "$APPDATA\\VideoLAN\\VLC"
ExecWait "$INSTDIR\vlc-cache-gen.exe $APPDATA\\VideoLAN\\VLC"
SetShellVarContext current
!macroend
!macro delprefs !macro delprefs
StrCpy $0 0 StrCpy $0 0
!define Index 'Line${__LINE__}' !define Index 'Line${__LINE__}'
...@@ -331,6 +339,9 @@ FunctionEnd ...@@ -331,6 +339,9 @@ FunctionEnd
Goto "${Index}-Loop" Goto "${Index}-Loop"
"${Index}-End:" "${Index}-End:"
!undef Index !undef Index
SetShellVarContext all
RMDir /r "$APPDATA\\VideoLAN"
SetShellVarContext current
!macroend !macroend
;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;
...@@ -414,6 +425,7 @@ Section $Name_Section01 SEC01 ...@@ -414,6 +425,7 @@ Section $Name_Section01 SEC01
; VLC.exe, libvlc.dll ; VLC.exe, libvlc.dll
!insertmacro InstallFile vlc.exe !insertmacro InstallFile vlc.exe
!insertmacro InstallFile vlc.exe.manifest !insertmacro InstallFile vlc.exe.manifest
!insertmacro InstallFile vlc-cache-gen.exe
; All dlls ; All dlls
!insertmacro InstallFile *.dll !insertmacro InstallFile *.dll
...@@ -428,6 +440,7 @@ Section $Name_Section01 SEC01 ...@@ -428,6 +440,7 @@ Section $Name_Section01 SEC01
@BUILD_SKINS_TRUE@ !insertmacro InstallFolder skins @BUILD_SKINS_TRUE@ !insertmacro InstallFolder skins
@BUILD_HTTPD_TRUE@ !insertmacro InstallFolder http @BUILD_HTTPD_TRUE@ !insertmacro InstallFolder http
@BUILD_LUA_TRUE@ !insertmacro InstallFolder lua @BUILD_LUA_TRUE@ !insertmacro InstallFolder lua
!insertmacro gencache
; URLs ; URLs
......
...@@ -821,9 +821,20 @@ static void AllocateAllPlugins( vlc_object_t *p_this, module_bank_t *p_bank ) ...@@ -821,9 +821,20 @@ static void AllocateAllPlugins( vlc_object_t *p_this, module_bank_t *p_bank )
/* Contruct the special search path for system that have a relocatable /* Contruct the special search path for system that have a relocatable
* executable. Set it to <vlc path>/plugins. */ * executable. Set it to <vlc path>/plugins. */
assert( vlcpath ); assert( vlcpath );
#ifndef WIN32
if( asprintf( &path, "%s" DIR_SEP "plugins", vlcpath ) != -1 ) if( asprintf( &path, "%s" DIR_SEP "plugins", vlcpath ) != -1 )
vlc_array_append( arraypaths, path ); vlc_array_append( arraypaths, path );
#else
/* Store the plugins cache in the common AppData folder */
char commonpath[PATH_MAX] = "";
int res = snprintf( commonpath, PATH_MAX -1, "%s\\VideoLAN\\VLC", config_GetConfDir());
if(res == -1 || res >= PATH_MAX)
{
vlc_array_destroy( arraypaths );
free(path);
return;
}
#endif
/* If the user provided a plugin path, we add it to the list */ /* If the user provided a plugin path, we add it to the list */
char *userpaths = var_InheritString( p_this, "plugin-path" ); char *userpaths = var_InheritString( p_this, "plugin-path" );
...@@ -845,17 +856,31 @@ static void AllocateAllPlugins( vlc_object_t *p_this, module_bank_t *p_bank ) ...@@ -845,17 +856,31 @@ static void AllocateAllPlugins( vlc_object_t *p_this, module_bank_t *p_bank )
size_t offset = p_module_bank->i_cache; size_t offset = p_module_bank->i_cache;
if( b_reset ) if( b_reset )
#ifndef WIN32
CacheDelete( p_this, path ); CacheDelete( p_this, path );
#else
CacheDelete( p_this, commonpath );
#endif
else else
#ifndef WIN32
CacheLoad( p_this, p_module_bank, path ); CacheLoad( p_this, p_module_bank, path );
#else
CacheLoad( p_this, p_module_bank, commonpath );
#endif
msg_Dbg( p_this, "recursively browsing `%s'", path ); msg_Dbg( p_this, "recursively browsing `%s'", path );
/* Don't go deeper than 5 subdirectories */ /* Don't go deeper than 5 subdirectories */
AllocatePluginDir( p_this, p_bank, path, 5 ); AllocatePluginDir( p_this, p_bank, path, 5 );
#ifndef WIN32
CacheSave( p_this, path, p_module_bank->pp_cache + offset, CacheSave( p_this, path, p_module_bank->pp_cache + offset,
p_module_bank->i_cache - offset ); p_module_bank->i_cache - offset );
#else
CacheSave( p_this, commonpath, p_module_bank->pp_cache + offset,
p_module_bank->i_cache - offset );
#endif
free( path ); free( path );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment