54
54
local act_os = dt .configuration .running_os
55
55
local PS = act_os == " windows" and " \\ " or " /"
56
56
57
- -- Detect OS and modify accordingly --
57
+ -- Detect OS and quit if not one of macOS, Windows or Linux --
58
58
local proper_install = true
59
59
if act_os ~= " macos" and act_os ~= " windows" and act_os ~= " linux" then
60
60
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' ))
62
62
return
63
63
end
64
64
@@ -72,13 +72,17 @@ fmng_cmd.windows = 'explorer.exe /select, '
72
72
local function open_in_fmanager (os , fmcmd )
73
73
local images = dt .gui .selection ()
74
74
local curr_image = " "
75
+ local run_cmd = " "
75
76
if # images == 0 then
76
77
dt .print (_ (' Please select an image' ))
77
78
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
82
86
dt .print_log (" OpenInExplorer run_cmd = " .. run_cmd )
83
87
resp = dsys .external_command (run_cmd )
84
88
end
91
95
-- GUI --
92
96
if proper_install then
93
97
dt .gui .libs .image .register_action (
94
- _ (" Show in file explorer" ),
98
+ _ (" show in file explorer" ),
95
99
function () open_in_fmanager (act_os , fmng_cmd [act_os ]) end ,
96
100
_ (" Opens File Explorer at the selected image's location" )
97
101
)
0 commit comments