Fix a few more things about filenames
This commit is contained in:
parent
2aac1b8179
commit
82231dbc98
|
@ -72,8 +72,7 @@ command.add(nil, {
|
||||||
local files = {}
|
local files = {}
|
||||||
for dir, item in core.get_project_files() do
|
for dir, item in core.get_project_files() do
|
||||||
if item.type == "file" then
|
if item.type == "file" then
|
||||||
local path = (dir == core.project_dir and "" or dir .. PATHSEP)
|
table.insert(files, common.home_encode(dir .. PATHSEP .. item.filename))
|
||||||
table.insert(files, common.home_encode(path .. item.filename))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
core.command_view:enter("Open File From Project", function(text, item)
|
core.command_view:enter("Open File From Project", function(text, item)
|
||||||
|
|
|
@ -41,10 +41,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
local function save(filename)
|
local function save(filename)
|
||||||
if filename then
|
doc():save(filename and core.normalize_to_working_dir(filename))
|
||||||
filename = core.normalize_to_working_dir(filename)
|
|
||||||
end
|
|
||||||
doc():save(filename)
|
|
||||||
local saved_filename = doc().filename
|
local saved_filename = doc().filename
|
||||||
core.on_doc_save(saved_filename)
|
core.on_doc_save(saved_filename)
|
||||||
core.log("Saved \"%s\"", saved_filename)
|
core.log("Saved \"%s\"", saved_filename)
|
||||||
|
|
|
@ -745,6 +745,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function core.set_visited(filename)
|
function core.set_visited(filename)
|
||||||
|
filename = common.home_encode(filename)
|
||||||
for i = 1, #core.visited_files do
|
for i = 1, #core.visited_files do
|
||||||
if core.visited_files[i] == filename then
|
if core.visited_files[i] == filename then
|
||||||
table.remove(core.visited_files, i)
|
table.remove(core.visited_files, i)
|
||||||
|
@ -798,16 +799,15 @@ function core.pop_clip_rect()
|
||||||
renderer.set_clip_rect(x, y, w, h)
|
renderer.set_clip_rect(x, y, w, h)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME: update comment
|
|
||||||
-- The function below works like system.absolute_path except it
|
-- The function below works like system.absolute_path except it
|
||||||
-- doesn't fail if the file does not exist. We consider that the
|
-- doesn't fail if the file does not exist. We consider that the
|
||||||
-- current dir is core.project_dir so relative filename are considered
|
-- current dir is core.working_dir so relative filename are considered
|
||||||
-- to be in core.project_dir.
|
-- to be in core.working_dir.
|
||||||
-- Please note that .. or . in the filename are not taken into account.
|
-- Please note that .. or . in the filename are not taken into account.
|
||||||
-- This function should get only filenames normalized using
|
-- This function should get only filenames normalized using
|
||||||
-- common.normalize_path function.
|
-- common.normalize_path function.
|
||||||
function core.working_dir_absolute_path(filename)
|
function core.working_dir_absolute_path(filename)
|
||||||
if filename:match('^%a:\\') or filename:find('/', 1, true) then
|
if filename:match('^%a:\\') or filename:find('/', 1, true) == 1 then
|
||||||
return filename
|
return filename
|
||||||
else
|
else
|
||||||
return core.working_dir .. PATHSEP .. filename
|
return core.working_dir .. PATHSEP .. filename
|
||||||
|
|
Loading…
Reference in New Issue