Do not force choosing project dir to suggestion

When changing or opening a project directory do not
take the selected item from suggestion but simply the
entered text as it is.

Otherwise the user may be unable to choose a directory
if the text matches the beginning of suggestion.

Close #791
This commit is contained in:
Francesco Abbate 2022-01-05 23:42:47 +01:00
parent 1b57107352
commit 1e7075ca9f
1 changed files with 4 additions and 4 deletions

View File

@ -152,8 +152,8 @@ command.add(nil, {
if dirname then
core.command_view:set_text(common.home_encode(dirname) .. PATHSEP)
end
core.command_view:enter("Change Project Folder", function(text, item)
text = system.absolute_path(common.home_expand(item and item.text or text))
core.command_view:enter("Change Project Folder", function(text)
text = system.absolute_path(common.home_expand(text))
if text == core.project_dir then return end
local path_stat = system.get_file_info(text)
if not path_stat or path_stat.type ~= 'dir' then
@ -172,8 +172,8 @@ command.add(nil, {
if dirname then
core.command_view:set_text(common.home_encode(dirname) .. PATHSEP)
end
core.command_view:enter("Open Project", function(text, item)
text = common.home_expand(item and item.text or text)
core.command_view:enter("Open Project", function(text)
text = common.home_expand(text)
local path_stat = system.get_file_info(text)
if not path_stat or path_stat.type ~= 'dir' then
core.error("Cannot open folder %q", text)