vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <h...@beauzee.fr> | Mon Apr 
 9 16:54:14 2018 +0200| [c0068e6b6592e5f61fbf1c44fd436fafb12e658f] | committer: 
Hugo Beauzée-Luyssen

VLSub: Simplify file opening checks

(cherry picked from commit 04311590e71ce6b4a64965a70b18a442635ea778)
Signed-off-by: Hugo Beauzée-Luyssen <h...@beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=c0068e6b6592e5f61fbf1c44fd436fafb12e658f
---

 share/lua/extensions/VLSub.lua | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index 8c857dc0f8..88fb5e042c 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -891,9 +891,8 @@ function save_config()
       "[VLSub] Saving config file:  "..
       openSub.conf.filePath)
 
-    if file_touch(openSub.conf.filePath) then
-      local tmpFile = assert(
-        vlc.io.open(openSub.conf.filePath, "wb"))
+    local tmpFile = vlc.io.open(openSub.conf.filePath, "wb")
+    if tmpFile ~= nil then
       local resp = dump_xml(openSub.option)
       tmpFile:write(resp)
       tmpFile:flush()
@@ -1652,10 +1651,10 @@ function dump_zip(url, dir, subfileName)
   end
 
   local tmpFileName = dir.."/"..subfileName..".gz"
-  if not file_touch(tmpFileName) then
+  local tmpFile = vlc.io.open(tmpFileName, "wb")
+  if tmpFile == nil then
     return false
   end
-  local tmpFile = assert(vlc.io.open(tmpFileName, "wb"))
 
   tmpFile:write(resp)
   tmpFile:flush()

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to