Skip to content

Commit f08421a

Browse files
authored
Update kml_export.lua
Fixed Windows problem
1 parent 18783e7 commit f08421a

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

contrib/kml_export.lua

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@ local function create_kml_file(storage, image_table, extra_data)
9292
dt.print_error(_("zip not found"))
9393
return
9494
end
95-
9695
exportDirectory = dt.configuration.tmp_dir
9796
imageFoldername = ""
9897
else
9998
exportDirectory = dt.preferences.read("kml_export","ExportDirectory","string")
100-
10199
-- Creates dir if not exsists
102100
imageFoldername = "files"..PS
103101
df.mkdir(df.sanitize_filename(exportDirectory..PS..imageFoldername))
@@ -119,6 +117,8 @@ local function create_kml_file(storage, image_table, extra_data)
119117
-- profiles that might be present in the input and aren't needed in the thumbnail.
120118

121119
local convertToThumbCommand = ds.sanitize(magickPath) .. " -size 96x96 "..exported_image.." -resize 92x92 -mattecolor \"#FFFFFF\" -frame 2x2 +profile \"*\" "..exportDirectory..PS..imageFoldername.."thumb_"..filename..".jpg"
120+
121+
df.file_copy(exported_image, exportDirectory..PS..imageFoldername..filename.."."..filetype)
122122
dsys.external_command(convertToThumbCommand)
123123
else
124124
-- Remove exported image if it has no GPS data
@@ -142,6 +142,7 @@ local function create_kml_file(storage, image_table, extra_data)
142142
filmName = string.gsub(filmName, "|", "")
143143
filmName = string.gsub(filmName, "*", "")
144144
filmName = string.gsub(filmName, "?", "")
145+
filmName = string.gsub(filmName,'[.]', "") -- At least Windwows has problems with the "." and the start command
145146
end
146147

147148
exportKMLFilename = filmName..".kml"
@@ -292,12 +293,21 @@ local function create_kml_file(storage, image_table, extra_data)
292293
end
293294

294295
-- Preferences
295-
dt.preferences.register("kml_export",
296-
"OpenKmlFile",
297-
"bool",
298-
_("KML export: Open KML/KMZ file after export"),
299-
_("Opens the KML file after the export with the standard program for KML files"),
300-
false )
296+
if dt.configuration.running_os == "windows" then
297+
dt.preferences.register("kml_export",
298+
"OpenKmlFile",
299+
"bool",
300+
_("KML export: Open KML file after export"),
301+
_("Opens the KML file after the export with the standard program for KML files"),
302+
false )
303+
else
304+
dt.preferences.register("kml_export",
305+
"OpenKmlFile",
306+
"bool",
307+
_("KML export: Open KML/KMZ file after export"),
308+
_("Opens the KML file after the export with the standard program for KML files"),
309+
false )
310+
end
301311

302312
local defaultDir = ''
303313
if dt.configuration.running_os == "windows" then
@@ -344,7 +354,11 @@ if dt.configuration.running_os == "linux" then
344354
end
345355

346356
-- Register
347-
dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file)
357+
if dt.configuration.running_os == "windows" then
358+
dt.register_storage("kml_export", _("KML Export"), nil, create_kml_file)
359+
else
360+
dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file)
361+
end
348362

349363
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
350364
-- kate: hl Lua;

0 commit comments

Comments
 (0)