From 45b2f56937691d055275687a504b2699dbf5b44a Mon Sep 17 00:00:00 2001 From: rxi Date: Thu, 21 May 2020 11:45:33 +0100 Subject: Changed `openfilelocation` and `openselected` to use system.exec Should resolve issue of command prompt briefly showing when these plugins are used --- plugins/openfilelocation.lua | 8 ++++---- plugins/openselected.lua | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua index e57b740..a97e47e 100644 --- a/plugins/openfilelocation.lua +++ b/plugins/openfilelocation.lua @@ -17,12 +17,12 @@ command.add("core.docview", { core.error "Cannot open location of unsaved doc" return end - local folder_name = doc.filename:match("^(.-)[^/\\]*$") - core.log("Opening \"%s\"", folder_name) + local folder = doc.filename:match("^(.*)[/\\].*$") or "." + core.log("Opening \"%s\"", folder) if PLATFORM == "Windows" then - os.execute(string.format("start %s %s", config.filemanager, folder_name)) + system.exec(string.format("%s %s", config.filemanager, folder)) else - os.execute(string.format("%s %q", config.filemanager, folder_name)) + system.exec(string.format("%s %q", config.filemanager, folder)) end end }) diff --git a/plugins/openselected.lua b/plugins/openselected.lua index 5fadbec..321d3e8 100644 --- a/plugins/openselected.lua +++ b/plugins/openselected.lua @@ -15,9 +15,9 @@ command.add("core.docview", { core.log("Opening \"%s\"...", text) if PLATFORM == "Windows" then - os.execute(string.format("start explorer %s", text)) + system.exec("explorer " .. text) else - os.execute(string.format("xdg-open %q &", text)) + system.exec(string.format("xdg-open %q", text)) end end, }) -- cgit v1.2.3