<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Hey Remi</div><div dir="ltr"><div>I dont't think a cache directory which does not exist is of much use. So whenever some lua extension asks for the cache directory it is made sure that it already exists. The problem regarding parent directory not existing, I went through dirs.c for different operating systems and they all return paths with cache directory being child directory of some directory created by the system by default. So, there is a high chance vlc_mkdir() will not fail here. Still if you feel that it can fail, i can write a recursive implementation to check the path and create directories as required.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 10, 2019 at 12:28 AM Remi Denis-Courmont <<a href="mailto:remi@remlab.net" target="_blank" rel="noreferrer">remi@remlab.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le 2019-03-09 16:01, Aakash Singh a écrit :<br>
> <a href="https://trac.videolan.org/vlc/ticket/21595" rel="noreferrer noreferrer" target="_blank">https://trac.videolan.org/vlc/ticket/21595</a> provides the description of<br>
> the issue.<br>
> <br>
> The cache folder is created if it doesn't already exist. If it exists<br>
> then vlc_mkdir() simply returns -1.<br>
<br>
First, it's questionable if the function should create the directory, or <br>
if that's the caller's responsibility. But in any case, this patch won't <br>
work if the parent directory does not exist.<br>
<br>
<br>
<br>
<br>
> <br>
> ---<br>
>  modules/lua/libs/configuration.c | 3 +++<br>
>  1 file changed, 3 insertions(+)<br>
> <br>
> diff --git a/modules/lua/libs/configuration.c<br>
> b/modules/lua/libs/configuration.c<br>
> index 27de94c30d..1c55d6c7d8 100644<br>
> --- a/modules/lua/libs/configuration.c<br>
> +++ b/modules/lua/libs/configuration.c<br>
> @@ -32,6 +32,7 @@<br>
>  #endif<br>
> <br>
>  #include <vlc_common.h><br>
> +#include <vlc_fs.h><br>
> <br>
>  #include "../vlc.h"<br>
>  #include "../libs.h"<br>
> @@ -136,6 +137,8 @@ static int vlclua_configdir( lua_State *L )<br>
>  static int vlclua_cachedir( lua_State *L )<br>
>  {<br>
>      char *dir = config_GetUserDir( VLC_CACHE_DIR );<br>
> +    /* create a cache folder if it doesn't already exist */<br>
> +    vlc_mkdir( dir, 0700 );<br>
>      lua_pushstring( L, dir );<br>
>      free( dir );<br>
>      return 1;<br>
> --<br>
> 2.19.1<br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br>
-- <br>
Rémi Denis-Courmont<br><br>
</blockquote></div>
</div></div>