diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-05-13 17:09:50 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-05-13 17:10:26 +0800 |
commit | 1d0a33637635a4f5a9a614c4bb0de17202c2d375 (patch) | |
tree | 828b2932ffc68f06c1f73921e9c62a3220e93b03 /script/3rd/lua-uri/uri/file/win32.lua | |
parent | d7daade3a3b8f4a5e33bca3df7ec0656d93684c2 (diff) | |
download | lua-language-server-1d0a33637635a4f5a9a614c4bb0de17202c2d375.zip |
改成使用自己的 file-uri
Diffstat (limited to 'script/3rd/lua-uri/uri/file/win32.lua')
-rw-r--r-- | script/3rd/lua-uri/uri/file/win32.lua | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/script/3rd/lua-uri/uri/file/win32.lua b/script/3rd/lua-uri/uri/file/win32.lua deleted file mode 100644 index d4e40243..00000000 --- a/script/3rd/lua-uri/uri/file/win32.lua +++ /dev/null @@ -1,34 +0,0 @@ -local M = { _NAME = "uri.file.win32" } -local URI = require "uri" -local Util = require "uri._util" - -function M.filesystem_path (uri) - local host = uri:host() - local path = Util.uri_decode(uri:path()) - if host ~= "" then path = "//" .. host .. path end - if path:find("^/[A-Za-z]|/") or path:find("^/[A-Za-z]|$") then - path = path:gsub("|", ":", 1) - end - if path:find("^/[A-Za-z]:/") then - path = path:sub(2) - elseif path:find("^/[A-Za-z]:$") then - path = path:sub(2) .. "/" - end - path = path:gsub("/", "\\") - return path -end - -function M.make_file_uri (path) - path = path:gsub("\\", "/") - if path:find("^[A-Za-z]:$") then path = path .. "/" end - local _, _, host, hostpath = path:find("^//([A-Za-z0-9.]+)/(.*)$") - host = host or "" - hostpath = hostpath or path - hostpath = hostpath:gsub("//+", "/") - hostpath = Util.uri_encode(hostpath, "^A-Za-z0-9%-._~!$&'()*+,;=@/") - if not hostpath:find("^/") then hostpath = "/" .. hostpath end - return assert(URI:new("file://" .. host .. hostpath)) -end - -return M --- vi:ts=4 sw=4 expandtab |