@@ -42,6 +42,8 @@ local df = require "lib/dtutils.file"
42
42
require " official/yield"
43
43
local gettext = dt .gettext
44
44
45
+ local PS = dt .configuration .running_os == " windows" and " \\ " or " /"
46
+
45
47
du .check_min_api_version (" 3.0.0" , kml_export )
46
48
47
49
-- Tell gettext where to find the .mo file translating messages for a particular domain
@@ -260,8 +262,8 @@ local function create_kml_file(storage, image_table, extra_data)
260
262
exportDirectory = dt .preferences .read (" kml_export" ," ExportDirectory" ," string" )
261
263
262
264
-- Creates dir if not exsists
263
- imageFoldername = " files/ "
264
- local mkdirCommand = " mkdir -p " .. exportDirectory .. " / " .. imageFoldername
265
+ imageFoldername = " files" .. PS
266
+ local mkdirCommand = " mkdir -p " .. exportDirectory .. PS .. imageFoldername
265
267
dt .control .execute (mkdirCommand )
266
268
end
267
269
@@ -280,7 +282,7 @@ local function create_kml_file(storage, image_table, extra_data)
280
282
-- will be scaled so its largest dimension is 120 pixels. The '+profile "*"' removes any ICM, EXIF, IPTC, or other
281
283
-- profiles that might be present in the input and aren't needed in the thumbnail.
282
284
283
- local convertToThumbCommand = " convert -size 96x96 " .. exported_image .. " -resize 92x92 -mattecolor \" #FFFFFF\" -frame 2x2 +profile \" *\" " .. exportDirectory .. " / " .. imageFoldername .. " thumb_" .. filename .. " .jpg"
285
+ local convertToThumbCommand = " convert -size 96x96 " .. exported_image .. " -resize 92x92 -mattecolor \" #FFFFFF\" -frame 2x2 +profile \" *\" " .. exportDirectory .. PS .. imageFoldername .. " thumb_" .. filename .. " .jpg"
284
286
dt .control .execute (convertToThumbCommand )
285
287
else
286
288
-- Remove exported image if it has no GPS data
@@ -394,7 +396,7 @@ local function create_kml_file(storage, image_table, extra_data)
394
396
kml_file = kml_file .. " </Document>\n "
395
397
kml_file = kml_file .. " </kml>"
396
398
397
- local file = io.open (exportDirectory .. " / " .. exportKMLFilename , " w" )
399
+ local file = io.open (exportDirectory .. PS .. exportKMLFilename , " w" )
398
400
file :write (kml_file )
399
401
file :close ()
400
402
@@ -405,8 +407,8 @@ local function create_kml_file(storage, image_table, extra_data)
405
407
exportDirectory = dt .preferences .read (" kml_export" ," ExportDirectory" ," string" )
406
408
407
409
local createKMZCommand = " zip --test --move --junk-paths "
408
- createKMZCommand = createKMZCommand .. " \" " .. exportDirectory .. " / " .. exportKMZFilename .. " \" " -- KMZ filename
409
- createKMZCommand = createKMZCommand .. " \" " .. dt .configuration .tmp_dir .. " / " .. exportKMLFilename .. " \" " -- KML file
410
+ createKMZCommand = createKMZCommand .. " \" " .. exportDirectory .. PS .. exportKMZFilename .. " \" " -- KMZ filename
411
+ createKMZCommand = createKMZCommand .. " \" " .. dt .configuration .tmp_dir .. PS .. exportKMLFilename .. " \" " -- KML file
410
412
411
413
for image ,exported_image in pairs (image_table ) do
412
414
if ((image .longitude and image .latitude ) and
@@ -416,7 +418,7 @@ local function create_kml_file(storage, image_table, extra_data)
416
418
-- Handle duplicates
417
419
filename = addDuplicateIndex ( image .duplicate_index , filename )
418
420
419
- createKMZCommand = createKMZCommand .. " \" " .. dt .configuration .tmp_dir .. " / " .. imageFoldername .. " thumb_" .. filename .. " .jpg\" " -- thumbnails
421
+ createKMZCommand = createKMZCommand .. " \" " .. dt .configuration .tmp_dir .. PS .. imageFoldername .. " thumb_" .. filename .. " .jpg\" " -- thumbnails
420
422
createKMZCommand = createKMZCommand .. " \" " .. exported_image .. " \" " -- images
421
423
end
422
424
end
@@ -429,9 +431,9 @@ local function create_kml_file(storage, image_table, extra_data)
429
431
local kmlFileOpenCommand
430
432
431
433
if ( dt .preferences .read (" kml_export" ," CreateKMZ" ," bool" ) == true ) then
432
- kmlFileOpenCommand = " xdg-open " .. exportDirectory .. " / \" " .. exportKMZFilename .. " \" "
434
+ kmlFileOpenCommand = " xdg-open " .. exportDirectory .. PS .. " \" " .. exportKMZFilename .. " \" "
433
435
else
434
- kmlFileOpenCommand = " xdg-open " .. exportDirectory .. " / \" " .. exportKMLFilename .. " \" "
436
+ kmlFileOpenCommand = " xdg-open " .. exportDirectory .. PS .. " \" " .. exportKMLFilename .. " \" "
435
437
end
436
438
dt .control .execute (kmlFileOpenCommand )
437
439
end
0 commit comments