1 |
|
%% @doc Short functions useful for config file manipulations. |
2 |
|
%% This stuff can be pure, but most likely not. |
3 |
|
%% It's for generic functions. |
4 |
|
-module(mongoose_config_utils). |
5 |
|
-export([exit_or_halt/1]). |
6 |
|
|
7 |
|
%% @doc If MongooseIM isn't yet running in this node, then halt the node |
8 |
|
-spec exit_or_halt(ExitText :: string()) -> none(). |
9 |
|
exit_or_halt(ExitText) -> |
10 |
:-( |
case [Vsn || {mongooseim, _Desc, Vsn} <- application:which_applications()] of |
11 |
|
[] -> |
12 |
:-( |
timer:sleep(1000), |
13 |
:-( |
halt(string:substr(ExitText, 1, 199)); |
14 |
|
[_] -> |
15 |
:-( |
exit(ExitText) |
16 |
|
end. |