Update kml_export.lua
use "lib/dtutils.file"
This commit is contained in:
@@ -37,9 +37,10 @@ USAGE
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local dt = require "darktable"
|
local dt = require "darktable"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
require "official/yield"
|
require "official/yield"
|
||||||
|
|
||||||
local gettext = dt.gettext
|
local gettext = dt.gettext
|
||||||
|
|
||||||
dt.configuration.check_version(...,{3,0,0},{4,0,0})
|
dt.configuration.check_version(...,{3,0,0},{4,0,0})
|
||||||
|
|
||||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
@@ -77,19 +78,6 @@ local function show_status(storage, image, format, filename, number, total, high
|
|||||||
dt.print(string.format(_("Export Image %i/%i"), number, total))
|
dt.print(string.format(_("Export Image %i/%i"), number, total))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkIfBinExists(bin)
|
|
||||||
local handle = io.popen("which "..bin)
|
|
||||||
local result = handle:read()
|
|
||||||
local ret
|
|
||||||
handle:close()
|
|
||||||
if (not result) then
|
|
||||||
dt.print_error(bin.." not found")
|
|
||||||
ret = false
|
|
||||||
end
|
|
||||||
ret = true
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Strip accents from a string
|
-- Strip accents from a string
|
||||||
-- Copied from https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string/
|
-- Copied from https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string/
|
||||||
function string.stripAccents( str )
|
function string.stripAccents( str )
|
||||||
@@ -176,16 +164,20 @@ end
|
|||||||
|
|
||||||
local function create_kml_file(storage, image_table, extra_data)
|
local function create_kml_file(storage, image_table, extra_data)
|
||||||
|
|
||||||
if not checkIfBinExists("mkdir") then
|
if not df.check_if_bin_exists("mkdir") then
|
||||||
|
dt.print_error(_("mkdir not found"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not checkIfBinExists("convert") then
|
if not df.check_if_bin_exists("convert") then
|
||||||
|
dt.print_error(_("convert not found"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not checkIfBinExists("xdg-open") then
|
if not df.check_if_bin_exists("xdg-open"") then
|
||||||
|
dt.print_error(_("xdg-open" not found"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not checkIfBinExists("xdg-user-dir") then
|
if not df.check_if_bin_exists("xdg-user-dir") then
|
||||||
|
dt.print_error(_("xdg-user-dir not found"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -193,7 +185,8 @@ local function create_kml_file(storage, image_table, extra_data)
|
|||||||
|
|
||||||
local imageFoldername
|
local imageFoldername
|
||||||
if ( dt.preferences.read("kml_export","CreateKMZ","bool") == true ) then
|
if ( dt.preferences.read("kml_export","CreateKMZ","bool") == true ) then
|
||||||
if not checkIfBinExists("zip") then
|
if not df.check_if_bin_exists("zip") then
|
||||||
|
dt.print_error(_("zip not found"))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user