Fix problem when project directory has a trailing slash
This commit is contained in:
@@ -38,7 +38,7 @@ function TreeView:get_cached(item, dirname)
|
||||
local t = dir_cache[item.filename]
|
||||
if not t then
|
||||
t = {}
|
||||
local basename = item.filename:match("[^\\/]+$")
|
||||
local basename = common.basename(item.filename)
|
||||
if item.topdir then
|
||||
t.filename = basename
|
||||
t.expanded = true
|
||||
@@ -145,7 +145,6 @@ end
|
||||
|
||||
local function create_directory_in(item)
|
||||
local path = item.abs_filename
|
||||
local basename = path:match("[^\\/]+$")
|
||||
core.command_view:enter("Create directory in " .. path, function(text)
|
||||
local dirname = path .. PATHSEP .. text
|
||||
local success, err = system.mkdir(dirname)
|
||||
|
||||
@@ -4,7 +4,7 @@ local DocView = require "core.docview"
|
||||
|
||||
|
||||
local function workspace_files_for(project_dir)
|
||||
local basename = project_dir:match("[^\\/]+$")
|
||||
local basename = common.basename(project_dir)
|
||||
local workspace_dir = USERDIR .. PATHSEP .. "ws"
|
||||
local info_wsdir = system.get_file_info(workspace_dir)
|
||||
if not info_wsdir then
|
||||
@@ -49,7 +49,7 @@ local function get_workspace_filename(project_dir)
|
||||
while id_list[id] do
|
||||
id = id + 1
|
||||
end
|
||||
local basename = project_dir:match("[^\\/]+$")
|
||||
local basename = common.basename(project_dir)
|
||||
return USERDIR .. PATHSEP .. "ws" .. PATHSEP .. basename .. "-" .. tostring(id)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user