Update geoJSON_export.lua

use "lib/dtutils.file"
This commit is contained in:
supertobi
2017-04-27 22:12:34 +02:00
committed by GitHub
parent bff2df018b
commit 79511d9b42

View File

@@ -33,9 +33,10 @@ USAGE
]]
local dt = require "darktable"
local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
dt.configuration.check_version(...,{3,0,0},{4,0,0})
-- Tell gettext where to find the .mo file translating messages for a particular domain
@@ -73,31 +74,21 @@ local function show_status(storage, image, format, filename, number, total, high
dt.print(string.format(_("Export Image %i/%i"), number, total))
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
local function create_geoJSON_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
end
if not checkIfBinExists("convert") then
if not df.check_if_bin_exists("convert") then
dt.print_error(_("convert not found"))
return
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
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
end