aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wxe_util.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/src/wxe_util.erl')
-rw-r--r--lib/wx/src/wxe_util.erl26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/wx/src/wxe_util.erl b/lib/wx/src/wxe_util.erl
index 02bca62486..a31c3e30b8 100644
--- a/lib/wx/src/wxe_util.erl
+++ b/lib/wx/src/wxe_util.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -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,14 +229,20 @@ 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]),
- erlang:error({load_driver, "No driver found"})
+ SrcPriv = filename:join(Priv, erlang:system_info(system_architecture)),
+ case file:read_file_info(filename:join(SrcPriv, Driver)) of
+ {ok, _} ->
+ SrcPriv;
+ {error, _} ->
+ opt_error_log(Silent,
+ "ERROR: Could not find \'~s\' in: ~s~n",
+ [Driver, Priv]),
+ erlang:error({load_driver, "No driver found"})
+ end
end.
strip(Src, Src) ->
@@ -244,3 +250,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.