Added getPathDivider()

This commit is contained in:
Luca Deri 2017-05-18 13:16:20 +02:00
parent 16bb7c174b
commit b0ccf9a96f

View file

@ -1168,10 +1168,18 @@ function purifyInterfaceName(interface_name)
return(interface_name)
end
function getPathDivider()
if(ntop.isWindows()) then
return "\\"
else
return "/"
end
end
-- Fix path format Unix <-> Windows
function fixPath(path)
if(ntop.isWindows() and (string.len(path) > 2)) then
path = string.gsub(path, "/", "\\")
path = string.gsub(path, "/", getPathDivider())
-- Avoid changing c:\.... into c_\....
path = string.sub(path, 1, 2) .. string.gsub(string.sub(path, 3), ":", "_")
-- io.write("->"..path.."\n")