Skip to content

Commit cc7ba37

Browse files
committed
Added checkIfBinExists
Added a check to test if hugin is installed.
1 parent d4a0341 commit cc7ba37

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

contrib/hugin.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
copyright (c) 2014 Wolfgang Goetz
55
copyright (c) 2015 Christian Kanzian
6+
copyright (c) 2015 Tobias Jakobs
67
78
darktable is free software: you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -40,18 +41,35 @@ dt.configuration.check_version(...,{2,0,0})
4041
-- Register
4142
dt.register_storage("module_hugin", "Hugin panorama", show_status, create_panorama, nil, nil)
4243

44+
local function checkIfBinExists(bin)
45+
local handle = io.popen("which "..bin)
46+
local result = handle:read()
47+
local ret
48+
handle:close()
49+
if (not result) then
50+
dt.print_error(bin.." not found")
51+
ret = false
52+
end
53+
ret = true
54+
return ret
55+
end
56+
4357
local function show_status(storage, image, format, filename,
4458
number, total, high_quality, extra_data)
4559
dt.print("Export to hugin "..tostring(number).."/"..tostring(total))
4660
end
4761

4862
local function create_panorama(storage, image_table, extra_data) --finalize
63+
if not checkIfBinExists("hugin") then
64+
return
65+
end
66+
4967
-- list of exported images
5068
local img_list
5169

5270
-- reset and create image list
5371
img_list = ""
54-
72+
5573
for _,v in pairs(image_table) do
5674
img_list = img_list ..v.. " "
5775
end

0 commit comments

Comments
 (0)