[vlc-devel] [vlc-commits] commit: Win32: Store the plugins cache in c:\ProgramData\VideoLAN\VLC, run vlc-cache-gen.exe at install time, and as a bonus, fixes #3308 ( Geoffroy Couprie )

Rémi Denis-Courmont remi at remlab.net
Fri Mar 5 22:14:49 CET 2010


Le vendredi 5 mars 2010 21:36:38 git version control, vous avez écrit :
> vlc | branch: master | Geoffroy Couprie <geal at videolan.org> | Wed Mar  3
>  18:49:59 2010 +0100| [0704d00ff7135d8283d70a3e45a98163f0d0ceec] |
>  committer: Geoffroy Couprie
> 
> Win32: Store the plugins cache in c:\ProgramData\VideoLAN\VLC, run
>  vlc-cache-gen.exe at install time, and as a bonus, fixes #3308
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0704d00ff7135d8283
> >d70a3e45a98163f0d0ceec
> 
> ---
> 
>  extras/package/win32/vlc.win32.nsi.in |   13 +++++++++++++
>  src/modules/modules.c                 |   27 ++++++++++++++++++++++++++-
>  2 files changed, 39 insertions(+), 1 deletions(-)
> 
> diff --git a/extras/package/win32/vlc.win32.nsi.in
>  b/extras/package/win32/vlc.win32.nsi.in index 0326326..f7712f9 100644
> --- a/extras/package/win32/vlc.win32.nsi.in
> +++ b/extras/package/win32/vlc.win32.nsi.in
> @@ -314,6 +314,14 @@ FunctionEnd
>  ; 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
>    StrCpy $0 0
>    !define Index 'Line${__LINE__}'
> @@ -331,6 +339,9 @@ FunctionEnd
>      Goto "${Index}-Loop"
>    "${Index}-End:"
>    !undef Index
> +  SetShellVarContext all
> +  RMDir /r "$APPDATA\\VideoLAN"
> +  SetShellVarContext current

Hmm, what if the user has another program, say VLMC in $APPDATA\VLMC ?

> +#ifndef WIN32
>      if( asprintf( &path, "%s" DIR_SEP "plugins", vlcpath ) != -1 )
>          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

Err, this is not the path to the plugins cache. That's the path to plugins.

>          else
> +#ifndef WIN32
>              CacheLoad( p_this, p_module_bank, path );
> +#else
> +             CacheLoad( p_this, p_module_bank, commonpath );
> +#endif

Reloading the cache from the same place for every plugin path makes no sense.

> +#ifndef WIN32
>          CacheSave( p_this, path, p_module_bank->pp_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

Consecutive plugin paths will overwrite each other's cache which is idiotic. 
Also, this brings back the bug that this was supposed to fix in the first 
place, that multiple VLC versions compete for the plugin cache. This sucks big 
time for developers and portable VLC users.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list