diff options
-rw-r--r-- | vlc-model.lua | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/vlc-model.lua b/vlc-model.lua index d2fe0cb..3e6e5f3 100644 --- a/vlc-model.lua +++ b/vlc-model.lua @@ -38,26 +38,16 @@ function getconfigfile() return modelfunctions.getfiledetails(configfile) end -get_filedetails = function (path) +function get_filedetails() local path=logfile - for line in string.gmatch(fs.read_file(configfile), "(.-)\n") do - path=string.match(line,"^VLC_OPTS.*%-%-logfile%s+(%S+)") or path - end - - - local file = path - local st = fs.stat(path) - if st and st.type then - while st.type == "link" do - st = fs.stat(posix.readlink(st.path)) + local path2 + if fs.is_file(configfile) then + for line in string.gmatch(fs.read_file(configfile) or "", "(.-)\n") do + path2=string.match(line,"^VLC_OPTS.*--logfile%s+(%S+)") or path2 end - file = st.path end - - local filedetails = modelfunctions.getfiledetails(file) - filedetails.value.filename.value = path - - return filedetails + if path2 then path=path2 end + return modelfunctions.getfiledetails(path) end function setconfigfile(filedetails) |