@@ -317,29 +317,27 @@ end
317
317
function save_callback (ui , id , v )
318
318
local options = 0
319
319
if config .transparent then options = 1 end
320
- local filenameAndPath
320
+ local fileNames
321
321
if config .fileDlg then
322
- filenameAndPath = simUI .fileDialog (
322
+ fileNames = simUI .fileDialog (
323
323
simUI .filedialog_type .save , ' title' , ' ' , ' screenshot.png' , ' image file' ,
324
324
' *'
325
325
)
326
326
else
327
- local theOs = sim . getInt32Param ( sim . intparam_platform )
328
- if theOs == 1 then
327
+ local fileName = ' coppeliaSim_screenshot_ ' .. os.date ( " %Y_%m_%d-%H_%M_%S " , os.time ()) .. ' .png '
328
+ if sim . getInt32Param ( sim . intparam_platform ) == 1 then
329
329
-- MacOS, special: executable is inside of a bundle:
330
- filenameAndPath = ' ../../../coppeliaSim_screenshot_' ..
331
- os.date (" %Y_%m_%d-%H_%M_%S" , os.time ()) .. ' .png'
332
- else
333
- filenameAndPath =
334
- ' coppeliaSim_screenshot_' .. os.date (" %Y_%m_%d-%H_%M_%S" , os.time ()) .. ' .png'
330
+ fileName = ' ../../../' .. fileName
335
331
end
332
+ fileNames = {fileName }
336
333
end
337
- if filenameAndPath then
338
- if sim .saveImage (image , {resX , resY }, options , filenameAndPath , - 1 ) ~= - 1 then
339
- sim .addLog (sim .verbosity_msgs , " Screenshot was saved to " .. filenameAndPath )
334
+ if # fileNames > 0 then
335
+ local fileName = fileNames [1 ]
336
+ if sim .saveImage (image , {resX , resY }, options , fileName , - 1 ) ~= - 1 then
337
+ sim .addLog (sim .verbosity_msgs , " Screenshot was saved to " .. fileName )
340
338
simUI .msgBox (
341
339
simUI .msgbox_type .info , simUI .msgbox_buttons .ok , ' Screenshot' ,
342
- " Screenshot was saved to " .. filenameAndPath
340
+ " Screenshot was saved to " .. fileName
343
341
)
344
342
else
345
343
sim .addLog (
0 commit comments