diff options
-rw-r--r-- | script/file-uri.lua | 4 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/script/file-uri.lua b/script/file-uri.lua index 88e1111a..f9ede668 100644 --- a/script/file-uri.lua +++ b/script/file-uri.lua @@ -92,6 +92,10 @@ function m.split(uri) return uri:match('([^:]*):/?/?([^/]*)(.*)') end +function m.isValid(uri) + return m.split(uri) ~= nil +end + function m.normalize(uri) if uri == '' then return uri diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 11fe0dfa..973ae9ec 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -45,7 +45,9 @@ end --- 初始化工作区 function m.create(uri) - uri = furi.normalize(uri) + if furi.isValid(uri) then + uri = furi.normalize(uri) + end log.info('Workspace create: ', uri) if uri == furi.encode '/' or uri == furi.encode(os.getenv 'HOME' or '') then |