Skip to content

Commit

Permalink
commandline parameter --force-accept-workspace
Browse files Browse the repository at this point in the history
resolve #2159
  • Loading branch information
sumneko committed Aug 11, 2023
1 parent ed35008 commit 1055a85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.7.0
* `NEW` support `---@type` and `--[[@as]]` for return statement
* `NEW` commandline parameter `--force-accept-workspace`: allowing the use of the root directory or home directory as the workspace
* `FIX` wrong hover and signature for method with varargs and overloads
* `FIX` [#2155]
* `FIX` [#2224]
Expand Down
2 changes: 1 addition & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ local function loadArgs()
end
end
if key then
_G[key:upper()] = getValue(value)
_G[key:upper():gsub('-', '_')] = getValue(value)
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions script/global.d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ jit = false
-- connect to client by socket
---@type integer
SOCKET = 0

-- Allowing the use of the root directory or home directory as the workspace
FORCE_ACCEPT_WORKSPACE = false
6 changes: 4 additions & 2 deletions script/workspace/workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function m.create(uri)
m.folders[#m.folders+1] = scp
if uri == furi.encode '/'
or uri == furi.encode(os.getenv 'HOME' or '') then
client.showMessage('Error', lang.script('WORKSPACE_NOT_ALLOWED', furi.decode(uri)))
scp:set('bad root', true)
if not FORCE_ACCEPT_WORKSPACE then
client.showMessage('Error', lang.script('WORKSPACE_NOT_ALLOWED', furi.decode(uri)))
scp:set('bad root', true)
end
end
end

Expand Down

0 comments on commit 1055a85

Please sign in to comment.