Merge pull request #165 from BzKevin/patch-1

Update OpenInExplorer
This commit is contained in:
wpferguson
2019-02-16 20:28:34 -05:00
committed by GitHub

View File

@@ -40,6 +40,9 @@ local dsys = require "lib/dtutils.system"
local proper_install = false local proper_install = false
if dt.configuration.running_os == "windows" then if dt.configuration.running_os == "windows" then
proper_install = true proper_install = true
else
dt.print_error('OpenInExplorer plug-in only supports Windows OS at this time')
return
end end
-- FUNCTION -- -- FUNCTION --
@@ -50,12 +53,17 @@ local function OpenInExplorer() --Open in Explorer
end end
local images = dt.gui.selection() local images = dt.gui.selection()
local curr_image = "" local curr_image = ""
if #images == 0 then
for _,image in pairs(images) do dt.print('please select an image')
curr_image = image.path..'\\'..image.filename elseif #images <= 15 then
local run_cmd = "explorer.exe /select, "..curr_image for _,image in pairs(images) do
dt.print_log("OpenInExplorer run_cmd = "..run_cmd) curr_image = image.path..'\\'..image.filename
resp = dsys.external_command(run_cmd) local run_cmd = "explorer.exe /select, "..curr_image
dt.print_log("OpenInExplorer run_cmd = "..run_cmd)
resp = dsys.external_command(run_cmd)
end
else
dt.print('please select fewer images (max 15)')
end end
end end
@@ -64,6 +72,6 @@ if proper_install then
dt.gui.libs.image.register_action( dt.gui.libs.image.register_action(
"show in file explorer", "show in file explorer",
function() OpenInExplorer() end, function() OpenInExplorer() end,
"Opens File Explorer at the selecte image's location" "Opens File Explorer at the selected image's location"
) )
end end