[vlc-devel] [PATCH] lua: fix loading file when the fs always reports mtime = 0

Mathieu Velten matmaul at gmail.com
Sat Mar 3 00:27:40 CET 2018


---
 share/lua/intf/http.lua | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index 1cf8946126..aaaecc41fb 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -89,13 +89,13 @@ function process_raw(filename)
 end
 
 function process(filename)
-    local mtime = 0    -- vlc.net.stat(filename).modification_time
+    local mtime = -1   -- vlc.net.stat(filename).modification_time
     local func = false -- process_raw(filename)
     return function(...)
         local new_mtime = vlc.net.stat(filename).modification_time
-        if new_mtime ~= mtime then
+        if new_mtime > mtime then
             -- Re-read the file if it changed
-            if mtime == 0 then
+            if mtime == -1 then
                 vlc.msg.dbg("Loading `"..filename.."'")
             else
                 vlc.msg.dbg("Reloading `"..filename.."'")
@@ -225,13 +225,13 @@ end
 
 function rawfile(h,path,url)
     local filename = path
-    local mtime = 0    -- vlc.net.stat(filename).modification_time
+    local mtime = -1   -- vlc.net.stat(filename).modification_time
     local page = false -- io.open(filename):read("*a")
     local callback = function(data,request)
         local new_mtime = vlc.net.stat(filename).modification_time
-        if mtime ~= new_mtime then
+        if new_mtime > mtime then
             -- Re-read the file if it changed
-            if mtime == 0 then
+            if mtime == -1 then
                 vlc.msg.dbg("Loading `"..filename.."'")
             else
                 vlc.msg.dbg("Reloading `"..filename.."'")
-- 
2.14.3



More information about the vlc-devel mailing list