aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wxe_util.erl
diff options
context:
space:
mode:
authorHÃ¥kan Mattsson <[email protected]>2012-06-12 13:25:01 +0200
committerHenrik Nord <[email protected]>2012-11-19 10:39:46 +0100
commit61ec7e2dc50b15e2677771c72a372bf0daf00950 (patch)
tree2a2581f8adf374ec2061943ebbd5a56d0cd86d6a /lib/wx/src/wxe_util.erl
parent5f3a7727464522da88d07a3012aa87b8703e3f3a (diff)
downloadotp-61ec7e2dc50b15e2677771c72a372bf0daf00950.tar.gz
otp-61ec7e2dc50b15e2677771c72a372bf0daf00950.tar.bz2
otp-61ec7e2dc50b15e2677771c72a372bf0daf00950.zip
Enable silent start of wx
Add {silent_start, boolean()} option to wx:new/1 in order to be able to suppress error messages during startup of wx.
Diffstat (limited to 'lib/wx/src/wxe_util.erl')
-rw-r--r--lib/wx/src/wxe_util.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl
index 02bca62486..3022b7f3f2 100644
--- a/lib/wx/src/wxe_util.erl
+++ b/lib/wx/src/wxe_util.erl
@@ -32,7 +32,7 @@
get_const/1,colour_bin/1,datetime_bin/1,
to_bool/1,from_bool/1]).
--export([wxgl_dl/0, priv_dir/1]).
+-export([wxgl_dl/0, priv_dir/2, opt_error_log/3]).
-include("wxe.hrl").
@@ -205,7 +205,7 @@ check_previous() ->
wxgl_dl() ->
DynLib0 = "erl_gl",
- PrivDir = priv_dir(DynLib0),
+ PrivDir = priv_dir(DynLib0, false),
DynLib = case os:type() of
{win32,_} ->
DynLib0 ++ ".dll";
@@ -214,7 +214,7 @@ wxgl_dl() ->
end,
filename:join(PrivDir, DynLib).
-priv_dir(Driver0) ->
+priv_dir(Driver0, Silent) ->
{file, Path} = code:is_loaded(?MODULE),
Priv = case filelib:is_regular(Path) of
true ->
@@ -229,13 +229,13 @@ priv_dir(Driver0) ->
_ ->
Driver0 ++ ".so"
end,
-
case file:read_file_info(filename:join(Priv, Driver)) of
{ok, _} ->
Priv;
{error, _} ->
- error_logger:format("ERROR: Could not find \'~s\' in: ~s~n",
- [Driver, Priv]),
+ opt_error_log(Silent,
+ "ERROR: Could not find \'~s\' in: ~s~n",
+ [Driver, Priv]),
erlang:error({load_driver, "No driver found"})
end.
@@ -244,3 +244,7 @@ strip(Src, Src) ->
strip([H|R], Src) ->
[H| strip(R, Src)].
+opt_error_log(false, Format, Args) ->
+ error_logger:format(Format, Args);
+opt_error_log(true, _Format, _Args) ->
+ ok.