<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>On Mon, Mar 25, 2019, at 18:45, Aakash Singh wrote:<br></div><blockquote type="cite" id="fastmail-quoted"><div dir="ltr"><div dir="ltr"><div>Hey everyone<br></div><div>Someone please review this patch. It was submitted a week ago and hasn't been reviewed yet.<br></div><div><br></div><div>Regards <br></div><div>Aakash Singh<br></div></div><div><br></div><div class="fastmail-quoted-gmail_quote"><div class="fastmail-quoted-gmail_attr" dir="ltr">On Tue, Mar 19, 2019 at 6:11 PM Aakash Singh <<a href="mailto:17aakashsingh1999@gmail.com">17aakashsingh1999@gmail.com</a>> wrote:<br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="fastmail-quoted-gmail_quote"><div dir="ltr"><div>The patch fixes creation of a cache directory for VLSub if it doesn't already exist. The patch is working correctly. If the directory already exists then vlc.io.mkdir() simply returns -1 indicating that the directory already exists and no changes were made to the folder structure.<br></div><div dir="ltr"><div>---<br></div><div> share/lua/extensions/VLSub.lua | 17 +++++++++++++++++<br></div><div> 1 file changed, 17 insertions(+)<br></div><div><br></div><div>diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua<br></div><div>index ee9e5f84a9..64013ae46a 100644<br></div><div>--- a/share/lua/extensions/VLSub.lua<br></div><div>+++ b/share/lua/extensions/VLSub.lua<br></div><div>@@ -1488,6 +1488,23 @@ function download_subtitles()<br></div><div> <br></div><div>   subfileName = subfileName.."."..item.SubFormat<br></div><div>   local tmp_dir = vlc.config.cachedir()<br></div><div>+  -- create the cache directory if it doens't already exist<br></div><div>+  if package.config:sub(1, 1):match("/") then<br></div><div>+    -- unix based systems<br></div><div>+    local current_dir = "/"<br></div><div>+    for dir in tmp_dir:gmatch("[^/]+") do<br></div><div>+      current_dir = current_dir.."/"..dir<br></div><div>+      vlc.io.mkdir(current_dir, "0700")<br></div><div>+    end<br></div><div>+  else<br></div><div>+    -- windows systems<br></div><div>+    local current_dir = ""<br></div><div>+    for dir in tmp_dir:gmatch("[^\\]+") do<br></div><div>+      current_dir = current_dir.."\\"..dir<br></div><div>+      vlc.io.mkdir(current_dir, "0700")<br></div><div>+    end<br></div><div>+  end<br></div></div></div></blockquote></div></div></blockquote><div><br></div><div>You could factorize it with only one loop by storing "\\" or "/" in an intermediate var.<br></div><div><br></div><div>But this bug brings an other question: Should VLC CORE take care of creating directories for every kind of user_dir ?<br></div><div>In other word, should config_GetUserDir() create the directory ?<br></div><div><br></div><blockquote type="cite" id="fastmail-quoted"><div dir="ltr"><div class="fastmail-quoted-gmail_quote"><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="fastmail-quoted-gmail_quote"><div dir="ltr"><div dir="ltr"><div>+<br></div><div>   local file_target_access = true<br></div><div> <br></div><div>   local tmpFileName = dump_zip(<br></div><div>-- <br></div><div>2.19.1<br></div></div></div></blockquote></div></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>