def HTTPServerInterface::init
path = $config['web_ui_root_path']
unless test ?e, path
if $HAVE_LIB['fileutils']
data_path = File::join($DATADIR, 'extras', 'web_ui')
die "Missing Web UI Root directory (checked \"#{$config['web_ui_root_path']}\" and \"#{path}\")." unless test ?e, data_path
$stderr.puts "Warning: Web UI Root (\"#{path}\") doesn't exist; copying it from \"#{data_path}\"..."
begin
FileUtils::cp_r(data_path, path)
rescue
die "Couldn't copy from data directory (\"#{data_path}\") to Web UI Root (\"#{path}\"): #$!"
end
else
die "Missing Web UI Root directory \"#{path}\"."
end
end
Thread.new do
$http_server = HTTPServer::new($config['http_server'])
$http_server.start
end
end