def show_file_input(view, title, on_done):
file = STATE.file(view.file_name())
if file == None:
path = s_cwd()
path = path + os.sep
else:
path = file.remote_path()
def on_done_callback(new_file):
log('The user has chosen: ' + new_file)
cwd = s_cwd()
if not new_file.startswith(cwd):
sublime.error_message('File must be under CWD:\n\n' + cwd)
return
path = new_file[len(cwd) + 1:]
file = File(cwd=cwd, path=path)
on_done(file)
view.window().show_input_panel(
caption=title,
initial_text=path,
on_done=on_done_callback,
on_change=None,
on_cancel=None,
)
评论列表
文章目录