diff options
author | dev2 <dev2@dev2> | 2019-05-17 19:10:40 -0700 |
---|---|---|
committer | dev2 <dev2@dev2> | 2019-05-17 19:10:40 -0700 |
commit | 3a54b4c405aa8d25e5b2cc721ca6d5482a052786 (patch) | |
tree | 0510589884b5e404d70cd7cfcea06a14aff17fb6 | |
parent | 812aba7246f74d62b04bb9b24e3c70bd6d33d523 (diff) | |
download | lua-language-server-3a54b4c405aa8d25e5b2cc721ca6d5482a052786.zip |
fix linux path uri
-rw-r--r-- | server/src/uri.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/uri.lua b/server/src/uri.lua index b41bc1db..9e49dd13 100644 --- a/server/src/uri.lua +++ b/server/src/uri.lua @@ -1,4 +1,5 @@ local fs = require 'bee.filesystem' +local platform = require 'bee.platform' local function decode(uri) -- Unix-like系统根是/ @@ -9,6 +10,12 @@ local function decode(uri) log.error('uri decode failed: ', uri) return nil end + + -- linux uri example: file:///home/user/project/ + if platform.OS == 'Linux' then + return fs.path(uri:sub(8)) + end + local names = {} for name in uri:sub(9):gmatch '[^%/]+' do names[#names+1] = name:gsub('%%([0-9a-fA-F][0-9a-fA-F])', function (hex) |