From 79511d9b42b7f25982435360d3d89f3c400d5c8d Mon Sep 17 00:00:00 2001 From: supertobi Date: Thu, 27 Apr 2017 22:12:34 +0200 Subject: [PATCH] Update geoJSON_export.lua use "lib/dtutils.file" --- contrib/geoJSON_export.lua | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/contrib/geoJSON_export.lua b/contrib/geoJSON_export.lua index 7ae8159..90bb16f 100644 --- a/contrib/geoJSON_export.lua +++ b/contrib/geoJSON_export.lua @@ -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