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

VLSub: Simplify file opening checks

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

 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 a7177aad40..bd97e94bbe 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -890,9 +890,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()
@@ -1658,10 +1657,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