From 5cac946d2a1a7459590d58debf68e2a709e08297 Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Wed, 30 Jul 2008 12:36:23 +0200 Subject: [PATCH] Allow dependent applications to already be started. Some people may run versions of erl that already starts up applications when it boots. Hence, we now test the startup of each application and just ignore if it is already started. Fix from Bengt Kleberg. --- lib/etorrent-1.0/src/etorrent.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/etorrent-1.0/src/etorrent.erl b/lib/etorrent-1.0/src/etorrent.erl index cb2a0a5..afb35ea 100644 --- a/lib/etorrent-1.0/src/etorrent.erl +++ b/lib/etorrent-1.0/src/etorrent.erl @@ -11,11 +11,17 @@ -define(RANDOM_MAX_SIZE, 999999999999). start() -> - ok = application:start(crypto), - ok = application:start(inets), - ok = application:start(sasl), - ok = application:start(mnesia), + %% Start dependent applications + Fun = fun(Application) -> + case application:start(Application) of + ok -> ok; + {error, {already_started, Application}} -> ok + end + end, + lists:foreach(Fun, [crypto, inets, mnesia, sasl]), + %% DB etorrent_mnesia_init:wait(), + %% Etorrent application:start(etorrent). start(_Type, _Args) -> -- 2.11.4.GIT