From cc7ba37eb603625d48bde948ddfb2d2f04de83bb Mon Sep 17 00:00:00 2001 From: supertobi Date: Wed, 9 Sep 2015 10:03:01 +0200 Subject: [PATCH] Added checkIfBinExists Added a check to test if hugin is installed. --- contrib/hugin.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/contrib/hugin.lua b/contrib/hugin.lua index d64a73a..2335553 100644 --- a/contrib/hugin.lua +++ b/contrib/hugin.lua @@ -3,6 +3,7 @@ copyright (c) 2014 Wolfgang Goetz copyright (c) 2015 Christian Kanzian + copyright (c) 2015 Tobias Jakobs darktable is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,18 +41,35 @@ dt.configuration.check_version(...,{2,0,0}) -- Register dt.register_storage("module_hugin", "Hugin panorama", show_status, create_panorama, nil, nil) +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 show_status(storage, image, format, filename, number, total, high_quality, extra_data) dt.print("Export to hugin "..tostring(number).."/"..tostring(total)) end local function create_panorama(storage, image_table, extra_data) --finalize + if not checkIfBinExists("hugin") then + return + end + -- list of exported images local img_list -- reset and create image list img_list = "" - + for _,v in pairs(image_table) do img_list = img_list ..v.. " " end