Skip to content

Commit 1055a85

Browse files
committed
commandline parameter --force-accept-workspace
resolve #2159
1 parent ed35008 commit 1055a85

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 3.7.0
44
* `NEW` support `---@type` and `--[[@as]]` for return statement
5+
* `NEW` commandline parameter `--force-accept-workspace`: allowing the use of the root directory or home directory as the workspace
56
* `FIX` wrong hover and signature for method with varargs and overloads
67
* `FIX` [#2155]
78
* `FIX` [#2224]

main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ local function loadArgs()
3636
end
3737
end
3838
if key then
39-
_G[key:upper()] = getValue(value)
39+
_G[key:upper():gsub('-', '_')] = getValue(value)
4040
end
4141
end
4242
end

script/global.d.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@ jit = false
7777
-- connect to client by socket
7878
---@type integer
7979
SOCKET = 0
80+
81+
-- Allowing the use of the root directory or home directory as the workspace
82+
FORCE_ACCEPT_WORKSPACE = false

script/workspace/workspace.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ function m.create(uri)
5050
m.folders[#m.folders+1] = scp
5151
if uri == furi.encode '/'
5252
or uri == furi.encode(os.getenv 'HOME' or '') then
53-
client.showMessage('Error', lang.script('WORKSPACE_NOT_ALLOWED', furi.decode(uri)))
54-
scp:set('bad root', true)
53+
if not FORCE_ACCEPT_WORKSPACE then
54+
client.showMessage('Error', lang.script('WORKSPACE_NOT_ALLOWED', furi.decode(uri)))
55+
scp:set('bad root', true)
56+
end
5557
end
5658
end
5759

0 commit comments

Comments
 (0)