Skip to content

Commit 91ab85c

Browse files
author
preklov
authored
Update OpenInExplorer.lua
1 parent ec0fe0b commit 91ab85c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

contrib/OpenInExplorer.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ end
5454
local act_os = dt.configuration.running_os
5555
local PS = act_os == "windows" and "\\" or "/"
5656

57-
--Detect OS and modify accordingly--
57+
--Detect OS and quit if not one of macOS, Windows or Linux--
5858
local proper_install = true
5959
if act_os ~= "macos" and act_os ~= "windows" and act_os ~= "linux" then
6060
proper_install = false
61-
dt.print_error(_('OpenInExplorer plug-in only supports Windows and Linux at this time'))
61+
dt.print_error(_('OpenInExplorer plug-in only supports macOS, Windows and Linux at this time'))
6262
return
6363
end
6464

@@ -72,13 +72,17 @@ fmng_cmd.windows = 'explorer.exe /select, '
7272
local function open_in_fmanager(os, fmcmd)
7373
local images = dt.gui.selection()
7474
local curr_image = ""
75+
local run_cmd = ""
7576
if #images == 0 then
7677
dt.print(_('Please select an image'))
7778
elseif #images <= 15 then
78-
for _,image in pairs(images) do
79-
curr_image = df.sanitize_filename(image.path..PS..image.filename)
80-
local run_cmd = fmcmd..curr_image
81-
if os == 'linux' then run_cmd = run_cmd .. [[ ""]] end
79+
for _,image in pairs(images) do
80+
curr_image = image.path..PS..image.filename
81+
if os == 'linux' then
82+
run_cmd = fmcmd .. df.sanitize_filename("file://"..curr_image) .. [[ ""]]
83+
else
84+
run_cmd = fmcmd .. df.sanitize_filename(curr_image)
85+
end
8286
dt.print_log("OpenInExplorer run_cmd = "..run_cmd)
8387
resp = dsys.external_command(run_cmd)
8488
end
@@ -91,7 +95,7 @@ end
9195
-- GUI --
9296
if proper_install then
9397
dt.gui.libs.image.register_action(
94-
_("Show in file explorer"),
98+
_("show in file explorer"),
9599
function() open_in_fmanager(act_os, fmng_cmd[act_os]) end,
96100
_("Opens File Explorer at the selected image's location")
97101
)

0 commit comments

Comments
 (0)