Skip to content

Commit

Permalink
Added disallowing mapping of the project directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkulchenko committed Jul 24, 2016
1 parent 7d153c5 commit d00f15b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/editor/filetree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,17 @@ local function treeSetConnectorsAndIcons(tree)
local dirPicker = wx.wxDirDialog(ide.frame, TR("Choose a directory to map"),
project ~= "" and project or wx.wxGetCwd(), wx.wxDIRP_DIR_MUST_EXIST)
if dirPicker:ShowModal(true) ~= wx.wxID_OK then return end
local dir = wx.wxFileName.DirName(FixDir(dirPicker:GetPath())):GetFullPath()
local dir = wx.wxFileName.DirName(FixDir(dirPicker:GetPath()))
local path = dir:GetFullPath()

-- don't remap the project directory
if dir:SameAs(wx.wxFileName(project)) then return end

local mapped = filetree.settings.mapped[project] or {}
for _, m in ipairs(mapped) do
if m == dir then return end -- already on the list
if m == path then return end -- already on the list
end
table.insert(mapped, dir)
table.insert(mapped, path)
filetree.settings.mapped[project] = mapped
refreshAncestors(tree:GetRootItem())
end
Expand Down

0 comments on commit d00f15b

Please sign in to comment.